vendredi 11 septembre 2015

Could not enter data: You have an error in your SQL syntax? Check line 1 ())

Here is the error it's returning:

Could not enter data: 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

How do i fix it, it's very annoying. Im a noob at programming MySQL and PHP. So any help would be appreciated.

Here is my code:

<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$conn = mysql_connect($dbhost, $dbuser, $dbpass);

if(! $conn )
{
   die('Could not connect: ' . mysql_error());
}

$sql = 'INSERT INTO users '.
   '(ID,Points) '.
   'VALUES ( "2222", "999"() )';

mysql_select_db('database1');
$retval = mysql_query( $sql, $conn );

if(! $retval )
{
   die('Could not enter data: ' . mysql_error());
}

echo "Entered data successfully\n";

mysql_close($conn);
 ?>

Thanks in advance.

Edit: Sry for asking this question, would delete it if i could.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire