search

Home  >  Q&A  >  body text

mysqli cannot update data

$sql="UPDATE 'student' SET 'course'='javascript','grade'=88,'WHERE 'id'=3"; prompt after running; connection successful, update failed. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''student' SET 'name'='Xiaoming', 'course'='javascript','grade'=88, 'create_tim' at line 1

rapturerapture1754 days ago1370

reply all(5)I'll reply

  • rapture

    rapture2020-02-13 09:18:57

    Ok, thank you

    reply
    0
  • 小可耐

    小可耐2020-02-12 12:28:53

    If you make a typo, the corresponding SQL will be prompted.

    reply
    0
  • 小可耐

    小可耐2020-02-12 12:28:21

    I don't understand what you are typing. You can modify it yourself in the web database online management, and then you will be prompted with the sql statement you believe.

    reply
    0
  • 天蓬老师

    天蓬老师2020-02-08 12:02:00

    Field and table names should use backticks instead of single quotes...the backticks are under the ESC key

    reply
    1
  • rapture

    $sql="UPDATE `student`, SET `course`=`javascript`,`grade`=88,WHERE `id`=3"; I changed it to the backtick under the ESC button, but there is still an error Error message: Update failed. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET `course`=`javascript`,`grade`=88,WHERE `id `=3' at line 1

    rapture · 2020-02-10 14:37:03
  • Cancelreply