0

I am trying to update multiple rows in my database using php and mysql.

Here is my php mysql statment:

$sql = "UPDATE book_store SET".
"title = '$_POST[title]', isbn = '$_POST[isbn]', price = '$_POST[price]', quantity = '$_POST[quantity]' ".
"WHERE ID = '$_POST[id]' ";

Here is my Error:

Error: 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 '= 'PHP and MySQL Web Development', isbn = '0672329166', price = '34.43', quantit' at line 1

What am I doing wrong?

3
Contributors
4
Replies
26
Views
4 Years
Discussion Span
Last Post by diafol
0

hai singularity~,

i think if you echo your $sql variable before executing,it display's as follows

UPDATE book_store SETtitle = '$_POST[title]', isbn = '$_POST[isbn]', price = '$_POST[price]', quantity = '$_POST[quantity]' WHERE ID = '$_POST[id]'

there is no space between 'SET' keyword and 'title'

so please provide space between 'SET' keyword and title

that might be the one giving the error i think

please check it once i guess right or not

let me know the status

Edited by radhakrishna.p: giving clarity on the solution

0

I needed another eye

what does it means.could you expalin?

let me know

happy coding

Edited by radhakrishna.p: getting clarity on the problem

0

Another pair of eyes = somebody else to take a fresh look at something, as you're going around in circles and continually looking at something from the same point of view.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.