I am trying to make cell editing and update mysql DB. If I delete the code of update date then everything go smooth. The code is as follow
—————-My first try———————————
$update_query = “UPDATE table
SET
serial
='”.mysql_real_escape_string($_GET[‘Serial’]).”‘,
date
='”.mysql_real_escape_string(‘$_GET[Dat’]).”‘
WHERE id
='”.mysql_real_escape_string($_GET[‘id’]).”‘”;
————————————————————–
—————-My second try———————————-
$dat=$_GET[‘Dat’];
list($msa, $month, $day, $year) = explode(‘ ‘, $ind);
$mo=array(“Jan”=>”01”, “Feb”=>”02”, “Mar”=>”03”, “Apr”=>”04”, “May”=>”05”, “Jun”=>”06”, “Jul”=>”07”, “Aug”=>”08”, “Sep”=>”09”, “Oct”=>”10”, “Nov”=>”11”, “Dec”=>”12”);
foreach($mo as $x => $x_value) {
if ($month==$x){
$mon=$x_value;
}
}
$arr= array($year,$mon,$day);
$dat=join(“-“,$arr);
$update_query = “UPDATE table
SET
serial
='”.mysql_real_escape_string($_GET[‘Serial’]).”‘,
date
='”.$dat.”‘
WHERE id
='”.mysql_real_escape_string($_GET[‘id’]).”‘”;
————————————————————————
My second try is tried to correct the format of the date to be exactly the same as my DB. The format is like “2015-07-31”.
I have tried to use form post with the similar code as my second try and it is succeed. Please help to give some comments.
Thanks