MYSQL PHP / command line syntax -


Need some help, syntax error is coming and I can not get the life of this error code and variables other Working for questions and tables / DBS.

Error message

Database found! Problems updating records MySQL error: There is an error in your SQL syntax; To use 'SET LastName =' dfm 'near

code , check the manual related to your MySQL server version for the correct syntax. >

  if (($ _ POST ['modified'])) {$ connection = mysqli_connect ("xxxxx", "xxxx", "xxxxx"); // Czech connection if (! Connection!) {Echo "connection fails:". Mysqli_connect_error (); } Else {// selection table $ dbName = "spr14_aglic006"; Mysqli_select_db ($ connection, $ dbName) or die (mysqli_error ()); Echo "database found! & Lt; br & gt;";   

SYNTAX error below

  $ query = ("UPDATE students SET FirstName = '". $ _ POST [' firstName '].' ', LastName = ''. $ _ POST ['Last name']. '', WHERE StudentID = '". $ _ POST [' PID ']."' ");   

SYNTAX Above the error

  $ res = mysqli_query ($ connection, $ query); if ($ res) {echo "  

Any help?

should be in the form of a query

  $ query = ("UPDATE students SET FirstName = '". $ _ POST [' firstname '].' ', LastName =' ". $ _ POST ['lastname]].' 'WHERE StudentID ='" $ _ Post ['PID']. "'');   

you

  SET FirstName = ''. $ _ POST ['first name']. '', LastName = '". $ _ POST ['lastname']. ' ', & Lt; -   

You also have the possibility for your SIL injection

You are using $ _POST data directly inside the query, instead Use PDO

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -