HTTP 500 error with MySQL INSERT and UPDATE queries

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
charp23
Forum Newbie
Posts: 9
Joined: Fri Jun 27, 2014 9:23 am

HTTP 500 error with MySQL INSERT and UPDATE queries

Post by charp23 »

I'm getting this error when the string I'm trying to insert or update in my table contains the text "create a table x" where "x" can be anything at all. The same happens if the text contains "create table x". I'm guessing that the text is interpreted as part of the SQL query, but I can't find any references to this problem to figure out how to correct it. This is happening with $full_details in the code below:

Code: Select all

mysqli_query($dbi,"UPDATE tracker_submits SET
	full_details='$full_details',
	updater='$_SESSION[id]',
	updatestamp='$timestamp'
WHERE submit_id='$postid'") or die(mysqli_connect_error()." Oops! Error Updating Post.");
Any help figuring this out will be greatly appreciated.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: HTTP 500 error with MySQL INSERT and UPDATE queries

Post by Christopher »

What is the error message from mysqli_error()? What is the actual value of $full_details? Did you try prepared statements to make sure your variables are escaped?
(#10850)
Post Reply