Help please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lacorp
Forum Newbie
Posts: 4
Joined: Sat Aug 30, 2008 4:24 pm

Help please

Post 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?
marcth
Forum Contributor
Posts: 142
Joined: Mon Aug 25, 2008 8:16 am

Re: Help please

Post 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());
 
lacorp
Forum Newbie
Posts: 4
Joined: Sat Aug 30, 2008 4:24 pm

Re: Help please

Post by lacorp »

thank you for your help but i solved the problem. Left is a reserved keyword :mrgreen:
Post Reply