thecase Posted June 29, 2009 Share Posted June 29, 2009 Hi, Cant seem to figure out why this SQL line wont insert to the db $query = sprintf("INSERT INTO raceadmin (username, matchid, text) VALUES ('%s', '%s', '%s')", mysql_real_escape_string($username), mysql_real_escape_string($id), mysql_real_escape_string($text2)); Any ideas will be greatful Thanks Quote Link to comment Share on other sites More sharing options...
celsoendo Posted June 30, 2009 Share Posted June 30, 2009 PHP error? MySQL error? what?!?! Anyway, before call mysql_query(), just print $query variable and check if the query is ok. Quote Link to comment Share on other sites More sharing options...
flyhoney Posted June 30, 2009 Share Posted June 30, 2009 <?php $query = " INSERT INTO raceadmin SET username = '%s', matchid = '%s', text = '%s' "; $query = sprintf( $query, mysql_real_escape_string($username), mysql_real_escape_string($id), mysql_real_escape_string($text2) ); $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.