CodeIgniter Forums
How to handle this code into codeigniter? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: How to handle this code into codeigniter? (/showthread.php?tid=55196)



How to handle this code into codeigniter? - El Forum - 10-14-2012

[eluser]Unknown[/eluser]
I'm not sure where to post this, but i need your help.

Below is a php code i made in a non codeigniter code work.
It is a check all and uncheck all delete function. i'm not sure where to put this if it's in the control model or view? can anyone please help me.
Code:
<?php

/*Check Box Commands*/
$id=$row_notification['user_id'];

if(isset($_POST['Delete'])) {
$checkbox = $_POST['checkbox'];
mysql_select_db($database_connection_ched, $connection_ched);
$id=$row_notification['user_id'];

for($i=0;$i<count($checkbox);$i++)
  {
   $delete = "DELETE FROM tb_user WHERE user_id=$checkbox[$i]";
   mysql_query($delete,$connection_ched);
  
  }
$result2 = mysql_query($delete);

if($result2)
{
echo "[removed]alert ('Successfully Deleted');[removed]";
echo "&lt;meta http-equiv=\"refresh\" content=\"0;URL=notification.php?\"&gt;"; }

}

/*End of Checkbox Commands*/
?&gt;