i want to delete some data use:
$dbc=mysql_connect(_SRV,_ACCID,_PWD) or die(_ERROR15.": ".mysql_error());
$db=mysql_select_db("qdbase",$dbc) or die(_ERROR17.": ".mysql_error());
switch(postVar('action')) {
case 'changedata':
changedata(postVar('id'),postVar('chlotno'),postVar('chrange'),postVar('chS'),postVar('chA'),postVar('chB'),postVar('chC'),postVar('chstatus'));
break;
case 'deldata':
deldata(postVar('delid'));
break;
}
function changedata($id,$chlotno,$chrange,$chS,$chA,$chB,$chC,$chstatus){
$ID = mysql_real_escape_string($id);
$Lot_no = mysql_real_escape_string($chlotno);
$Range = mysql_real_escape_string($chrange);
$S = mysql_real_escape_string($chS);
$A = mysql_real_escape_string($chA);
$B = mysql_real_escape_string($chB);
$C = mysql_real_escape_string($chC);
$Status = mysql_real_escape_string($chstatus);
$Lot_no=strtoupper($Lot_no);
$Range=strtoupper($Range);
$sql = "UPDATE inspection_report SET Lot_no = '".$Lot_no."', Range_sampling = '".$Range."', S = '".$S."', ";
$sql.= "A = '".$A."', B = '".$B."', C = '".$C."', Status = '".$Status."' ";
$sql.= "WHERE id = ".$ID;
echo $sql;
$result=mysql_query($sql) or die(_ERROR26.": ".mysql_error());
//echo $result;
mysql_close($dbc);
}
function deldata($id){
$ID = mysql_real_escape_string($id);
$sql = "DELETE FROM inspection_report WHERE id = '".$ID."'";
echo $sql;
$result=mysql_query($sql) or die(_ERROR26.": ".mysql_error());
//echo $result;
mysql_close($dbc);
}
I have not found any error message in this query and show "200,OK". But the data still exist (not deleted). why its happen? is there something wrong in my query?
echo $sql:DELETE FROM inspection_report WHERE id = ''