rhyspaterson Posted July 4, 2007 Share Posted July 4, 2007 Hey guys, Trying to run quite a simple piece of code: $query = "SELECT * FROM usr WHERE regno = $registrationID"; However i am getting syntax errors at the end of the line, but not sure what i am doing wrong.. any suggestions? Cheers Link to comment https://forums.phpfreaks.com/topic/58352-solved-php-sql/ Share on other sites More sharing options...
teng84 Posted July 4, 2007 Share Posted July 4, 2007 can you send us the error Link to comment https://forums.phpfreaks.com/topic/58352-solved-php-sql/#findComment-289340 Share on other sites More sharing options...
rhyspaterson Posted July 4, 2007 Author Share Posted July 4, 2007 Warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at end of input LINE 1: SELECT * FROM usr WHERE regno = ^ in /var/www/menu/client/form/process.php on line 11 Query failed: ERROR: syntax error at end of input LINE 1: SELECT * FROM usr WHERE regno = ^ Link to comment https://forums.phpfreaks.com/topic/58352-solved-php-sql/#findComment-289341 Share on other sites More sharing options...
teng84 Posted July 4, 2007 Share Posted July 4, 2007 $query = "SELECT * FROM usr WHERE regno = ".$registrationID.""; try that or check if $registrationID has value Link to comment https://forums.phpfreaks.com/topic/58352-solved-php-sql/#findComment-289344 Share on other sites More sharing options...
trq Posted July 4, 2007 Share Posted July 4, 2007 $query = "SELECT * FROM usr WHERE regno = '$registrationID'"; Link to comment https://forums.phpfreaks.com/topic/58352-solved-php-sql/#findComment-289356 Share on other sites More sharing options...
rhyspaterson Posted July 4, 2007 Author Share Posted July 4, 2007 Thanks for the reply. I have tried that above code previously as well. However i receive a different error message: Warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid input syntax for integer: "" in /var/www/menu/client/form/process.php on line 11 Query failed: ERROR: invalid input syntax for integer: "" I do checks to ensure $registrationID is not NULL and is only numbers. Any suggestions? Link to comment https://forums.phpfreaks.com/topic/58352-solved-php-sql/#findComment-289364 Share on other sites More sharing options...
rhyspaterson Posted July 4, 2007 Author Share Posted July 4, 2007 Ah sorry, yes the above code did work. Thank you v. much Link to comment https://forums.phpfreaks.com/topic/58352-solved-php-sql/#findComment-289368 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.