lacorp Posted August 30, 2008 Share Posted August 30, 2008 Here is my code: <?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? Link to comment https://forums.phpfreaks.com/topic/122036-solved-help-please/ Share on other sites More sharing options...
genericnumber1 Posted August 30, 2008 Share Posted August 30, 2008 make sure mods is a table and left is a field in that table... if both of these are true, try removing the single quotes around the 1 Link to comment https://forums.phpfreaks.com/topic/122036-solved-help-please/#findComment-629964 Share on other sites More sharing options...
.josh Posted August 30, 2008 Share Posted August 30, 2008 left is a reserved word you can use it with mysql if you put backticks around it like this `left` but it's good programming practice to not use reserved words in the first place Link to comment https://forums.phpfreaks.com/topic/122036-solved-help-please/#findComment-629965 Share on other sites More sharing options...
lacorp Posted August 30, 2008 Author Share Posted August 30, 2008 Oh... thanks. Are any of these following words reserved words: 1. right 2. top 3. main 4. foot thank you so much for your help Link to comment https://forums.phpfreaks.com/topic/122036-solved-help-please/#findComment-629968 Share on other sites More sharing options...
lacorp Posted August 30, 2008 Author Share Posted August 30, 2008 Nevermind, looked it up myself. thanks for all your help. Link to comment https://forums.phpfreaks.com/topic/122036-solved-help-please/#findComment-629978 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.