Jump to content

[SOLVED] Array deletion showing same mesage every time


vinpkl

Recommended Posts

hi all

 

i have multiple checkboxes which holds value of "order_id" in my form based on arrays.

 

The code i m using works fine and deletes the order based on selected checkbox.

 

When order gets deleted then it shows message "Order deleted".

 

But the problem i m facing is that if the order doesnt gets deleted then also it shows message "Order deleted".

 

Means everytime it shows same message "Order deleted successfully" whether order gets deleted or not.

 

if(isset($_REQUEST['submit']))
{
$selcheckbox=array();
$selcheckbox=$_REQUEST['item'];
$count=count($selcheckbox);
for($i=0;$i<$count-1;$i++)
{
$del_id = $selcheckbox[$i];

$qry2 = "delete FROM new_order WHERE order_id=$del_id and payment_status='PENDING'";
$result2 = mysql_query($qry2);
if(mysql_query($qry2))
{
$msg="order ( ".$del_id." ) Deleted Successfully";
}
else
{
$msg="Error Deleting order";
}
}
}

 

This is html


echo "<td valign=top>". "<input type='checkbox' name='item[]' id='item[]' value=". $row['order_id']. ">"."</td>";

 

vineet

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.