Page 1 of 1

PHP Question [SOLVED]

Posted: Sat Feb 14, 2004 2:48 pm
by John Cartwright

Code: Select all

<?php
if ($submitrecord == "SUBMIT") { 
     if ($league == "cal") { 


	$sql = "INSERT INTO 'records_cal', 'records_total' SET opponents='$opponent', date='$date', map='$map', league='$league', outcome='$outcome'" ; 
	
	}

// Confirming data has been entered or not
  if (@mysql_query($sql)) { 
    echo("<div align="center">Your Record has been added.</div>"); 
  } else { 
    echo ("<div align="center">Error adding submitted record: " . mysql_error() . "</div>"); 
  } 
}
?>
I come on and try it, and i start getting this error:

Error adding submitted record: 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 ''records_cal' SET opponents='Test', date='2004-01-01', map='de_

Posted: Sat Feb 14, 2004 4:50 pm
by DuFF
In this line try echoing out the entire query so we can see whats happening:

Code: Select all

<?php
else {
    echo ("<div align="center">Error adding submitted record: " . mysql_error() . "<br />Original Query: " . $sql . "</div>");
  } 
?>

Posted: Sat Feb 14, 2004 5:15 pm
by Cruzado_Mainfrm
phenom, don't ask the moderators of this forum to delete this post, it might help other people someday that had the same problem...
or is it that you don't want to look back in the future and see a question like this one being one of yours? :wink: it's ok, maybe you'll look back at this post to fix your code again if u have the same problem another time...

Posted: Sat Feb 14, 2004 7:39 pm
by Straterra
Yes, please make the name of this topic back to its normal, but with [FIXED] or something of that matter in it.

Posted: Sat Feb 14, 2004 10:48 pm
by m3mn0n
Wish granted.