jQWidgets Forums

jQuery UI Widgets Forums Grid Unable to update DATE field in mysql database

Tagged: , ,

This topic contains 1 reply, has 2 voices, and was last updated by  ivailo 9 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • abepara
    Participant

    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


    ivailo
    Participant

    Hi abepara,

    Send your javascript for analyze.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.