paulman888888 Posted June 2, 2008 Share Posted June 2, 2008 I have made my code but i get an error. Below is my code. <?php $ip = $_SERVER['REMOTE_ADDR']; $today = date("m.d.y"); $time = time("H"); // Insert a row of information into the table "myscore2" mysql_query("INSERT INTO myscore2 (name, score, gameid, mode, thedate, thetime, ) VALUES('" . mysql_real_escape_string(substr($_GET['name'], 0, 13)) . "', '" . mysql_real_escape_string($_GET['score']) . "', '" . mysql_real_escape_string($_GET['gameid']) . "', '" . mysql_real_escape_string($_GET['mode']) . "', '" . mysql_real_escape_string('{$today}') . "', '" . mysql_real_escape_string('{$time}') . "', '" . mysql_real_escape_string('{$ip}') . "', )") or die(mysql_error()); echo "Score Uploaded!#"; ?> and i get this 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 ') VALUES('testing1111', '9999', '444', '1', '{$today}', '{$time} What am i doing wrong? Thankyou Link to comment https://forums.phpfreaks.com/topic/108406-solved-error-please-help/ Share on other sites More sharing options...
almightyegg Posted June 2, 2008 Share Posted June 2, 2008 mysql_query("INSERT INTO myscore2 (name, score, gameid, mode, thedate, thetime) VALUES('" . mysql_real_escape_string(substr($_GET['name'], 0, 13)) . "', '" . mysql_real_escape_string($_GET['score']) . "', '" . mysql_real_escape_string($_GET['gameid']) . "', '" . mysql_real_escape_string($_GET['mode']) . "', '" . mysql_real_escape_string('{$today}') . "', '" . mysql_real_escape_string('{$time}') . "', '" . mysql_real_escape_string('{$ip}') . "')") or die(mysql_error()); Try that Link to comment https://forums.phpfreaks.com/topic/108406-solved-error-please-help/#findComment-555732 Share on other sites More sharing options...
paulman888888 Posted June 2, 2008 Author Share Posted June 2, 2008 what have you changed? Link to comment https://forums.phpfreaks.com/topic/108406-solved-error-please-help/#findComment-555738 Share on other sites More sharing options...
revraz Posted June 2, 2008 Share Posted June 2, 2008 The error is coming from the Comma after thetime Link to comment https://forums.phpfreaks.com/topic/108406-solved-error-please-help/#findComment-555739 Share on other sites More sharing options...
almightyegg Posted June 2, 2008 Share Posted June 2, 2008 And the comma after the last value. Just copy and past that it and see if you get any more errors Link to comment https://forums.phpfreaks.com/topic/108406-solved-error-please-help/#findComment-555741 Share on other sites More sharing options...
paulman888888 Posted June 2, 2008 Author Share Posted June 2, 2008 thankyou guys so much. It works. Link to comment https://forums.phpfreaks.com/topic/108406-solved-error-please-help/#findComment-555757 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.