Jump to content

Recommended Posts

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.