Not connecting to datbase - resource id syntax error

Please can anyone help / advise:

I’m sure i succeeeded with the code below, but now just keep getting the error message 1064. I can’t see any syntax erros and i’m convinced i’ve set up the database structure etc correctly via phpmyadmin.

1064: 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 ‘Resource id #2’ at line 1

Using the following code :

$conn = mysql_connect(“localhost”, “user”, “password”);
$rs = mysql_query($conn);
if (mysql_errno())
{
die("
" . mysql_errno().": “.mysql_error().”
");
};
$qdb = mysql_select_db(‘database’);
$rs = mysql_query($qdb) or die (‘error selecting database table’ );
if (mysql_errno())
{
die("
" . mysql_errno().": “.mysql_error().”
");
};
$sql = “insert into table
(Club, AsAno, KeYcoDein, FName, SName, Age, DoBd, DoBm, DoBy, Gender ) values
(’$Club’, ‘$num5’, ‘$newentry’, ‘$FName’, ‘$SName’, ‘$num1’, ‘$num2’, ‘$num3’, ‘$num4’, ‘$Gend’ )”;
$rs = mysql_query($sql) or die (‘error inserting data to database table’ );
if (mysql_errno())
{
die("
" . mysql_errno().": “.mysql_error().”
");
};
mysql_close($conn);

You have too much calls to mysql_query(). Argument of this function is SQL expression. What is the purpose of these two commands in your code?
[php]$rs = mysql_query($conn);[/php]
[php]$rs = mysql_query($qdb) or die (‘error selecting database table’ );[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service