jaxdevil Posted February 1, 2008 Share Posted February 1, 2008 <?php $db_host = "localhost"; $db_user = "usice_usice"; $db_pwd = "xxxxxx"; $db_name = "usice_usice"; mysql_connect($db_host, $db_user, $db_pwd); mysql_select_db($db_name) or die(mysql_error()); $query = "SELECT * FROM `products` WHERE mod = '$icemachines' LIMIT 1"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); { ?> here is where my data is on page <? } ?> Anyone see a problem there? I can't, and I ran it through my proofing program and it didn't find a problem, yet it keeps saying: "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 '= 'US2000' LIMIT 1' at line 1" Anyone have any idea? Link to comment https://forums.phpfreaks.com/topic/88957-solved-problem-with-syntax-but-i-cant-see-it/ Share on other sites More sharing options...
quickstopman Posted February 1, 2008 Share Posted February 1, 2008 well first of all i don't ever see "US2000" anywhere in that code so i don't know where it could be Link to comment https://forums.phpfreaks.com/topic/88957-solved-problem-with-syntax-but-i-cant-see-it/#findComment-455606 Share on other sites More sharing options...
jaxdevil Posted February 1, 2008 Author Share Posted February 1, 2008 The US2000 is a post item sent to the page from a form (i.e. http://www.website.com/class.php?icemachines=US2000 ) So when $icemachines is inserted it draws that data into its place, that way the page is dynamic for every item in my database by making a single form field change. Whats funny is I use this SAME sql/php code on 3 other sites I made and they all work perfect. I actually just copied it from one of the other sites, changed the sql connect settings and the database names and column names. Anyone? Link to comment https://forums.phpfreaks.com/topic/88957-solved-problem-with-syntax-but-i-cant-see-it/#findComment-455608 Share on other sites More sharing options...
quickstopman Posted February 1, 2008 Share Posted February 1, 2008 i know i just looked it over more carefully Link to comment https://forums.phpfreaks.com/topic/88957-solved-problem-with-syntax-but-i-cant-see-it/#findComment-455609 Share on other sites More sharing options...
sasa Posted February 1, 2008 Share Posted February 1, 2008 mod is function in MySQL use $query = "SELECT * FROM `products` WHERE `mod` = '$icemachines' LIMIT 1"; Link to comment https://forums.phpfreaks.com/topic/88957-solved-problem-with-syntax-but-i-cant-see-it/#findComment-455612 Share on other sites More sharing options...
Barand Posted February 1, 2008 Share Posted February 1, 2008 For reference http://dev.mysql.com/doc/refman/4.1/en/reserved-words.html Link to comment https://forums.phpfreaks.com/topic/88957-solved-problem-with-syntax-but-i-cant-see-it/#findComment-455614 Share on other sites More sharing options...
jaxdevil Posted February 1, 2008 Author Share Posted February 1, 2008 THANKS MAN! I never would have figured that out on my own, you are a lifesaver. Thanks, SK Link to comment https://forums.phpfreaks.com/topic/88957-solved-problem-with-syntax-but-i-cant-see-it/#findComment-455616 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.