coopergl Posted August 8, 2006 Share Posted August 8, 2006 Here's the whole error message:Error fetching number details: 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 'desc FROM house_num WHERE house_num.id='1'' at line 1This is the query that causes it:$numb = @mysql_query( "SELECT number, desc FROM house_num WHERE house_num.id='$id'"); if (!$numb) { exit('<p>Error fetching number details: ' . mysql_error() . '</p>'); }Any ideas what is wrong with this?Using Mysql 4.0.27 and PHP 4.4.2Thanks in advance Quote Link to comment Share on other sites More sharing options...
logu Posted August 8, 2006 Share Posted August 8, 2006 Hi, I think the error is using the field "desc" it a keyword in sql for descending order . so change it to some thing and try Regards logu Quote Link to comment Share on other sites More sharing options...
corbin Posted August 8, 2006 Share Posted August 8, 2006 [code=php:0]$numb = @mysql_query( "SELECT `number`, `desc` FROM `house_num` WHERE `house_num.id`='$id'"); if (!$numb) { exit('<p>Error fetching number details: ' . mysql_error() . '</p>'); }[/code]Should also work... Not sure though Quote Link to comment Share on other sites More sharing options...
coopergl Posted August 8, 2006 Author Share Posted August 8, 2006 You're absolutely right. Changing the desc field name cured the problem.Thanks very much.Geoff. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.