Skip navigation links

MySQL Forums :: PHP :: Getting a syntax error even though query seems to have worked


Advanced Search

Getting a syntax error even though query seems to have worked
Posted by: san bautista ()
Date: September 24, 2012 01:44PM

I am trying to add a field for a user to upload a logo to my membership page. I have everything working except for that I get a syntax error when I run my query.

Here is the error:

query failed: (1064) 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 'WHERE UserID='128'' at line 1

And here is my code:

if (!$mysqli->query("INSERT INTO mem_user (data) VALUES ('".$handle->file_dst_pathname."') WHERE UserID='".$user->userID."'"));
echo "query failed: (" . $mysqli->errno . ") " . $mysqli->error;

Now, I know I am doing something wrong with the apostrophes and quatation marks, but I dont know what. Ive tried every combination and it still gives the error. As you can see in the error, the query still runs, but fails to insert.

please help!

Options: ReplyQuote


Subject Written By Posted
Getting a syntax error even though query seems to have worked san bautista 09/24/2012 01:44PM
Re: Getting a syntax error even though query seems to have worked san bautista 09/24/2012 03:50PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.