Page 1 of 1

Help please

Posted: Sat Aug 30, 2008 4:29 pm
by lacorp
Here is my code:

Code: Select all

<?php
$dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("anima33_have");
mysql_query("SELECT * FROM mods WHERE left='1'") or die(mysql_error());
?>
And I keep getting:
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 '='1'' at line 1
Help please?

Re: Help please

Posted: Sat Aug 30, 2008 4:33 pm
by marcth
If left is a number, then:

Code: Select all

 
$dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
 mysql_select_db ("anima33_have");
 mysql_query("SELECT * FROM mods WHERE left=1") or die(mysql_error());
 

Re: Help please

Posted: Sat Aug 30, 2008 4:37 pm
by lacorp
thank you for your help but i solved the problem. Left is a reserved keyword :mrgreen: