MySQL Forums
Forum List  »  PHP

mySQL syntax error?
Posted by: casey deshotels
Date: August 02, 2005 09:29PM

I'm running the script below on a php 4.3.4 server, and it's updating the db, but it's also dying and giving the mySQL syntax error= "Query 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 '= ''' at line 1"

I can't seem to figure it out - works, but throws the die error..... the code is below

function Location($URL, $addToken = 1) {
$questionORamp = (strstr($URL, "?"))?"&":"?";
$location = ($addToken)?$URL.$questionORamp.$SID:$URL; //append the sessionID ($SID) by default
ob_end_clean(); //clear buffer, end collection of content
if(headers_sent()) {
print('<META http-equiv="Refresh" content="0;URL="'.$location.'">');
} else {
header("Location: ".$location); //forward to another page
exit; //end the PHP processing

//redirect when save complete, with status msg.
$qContent="UPDATE content SET ".$_POST["field"]." = '".$_POST[$_POST["field"]]."'";
$qContent = mysql_query($qContent)// or die ('Query Error: ' . mysql_error());
Location("index.php?message=Your changes were saved successfully.");

Options: ReplyQuote

Written By
mySQL syntax error?
August 02, 2005 09:29PM
August 03, 2005 12:59AM
August 03, 2005 10:17AM
August 04, 2005 12:31AM

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.