Thread: php
View Single Post
 
Old May 13th, 2008, 09:16 AM
ciderpunx ciderpunx is offline
Friend of Wrox
Points: 1,515, Level: 15
Points: 1,515, Level: 15 Points: 1,515, Level: 15 Points: 1,515, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Oxford, , United Kingdom.
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

A quick hint on debugging sql problems is to print your sql statement. It would have helped here ;)

Code:
$query="SELECT  movie_name,movie_type ".
       "FROM MOVIE".
       "WHERE movie_year>1990 ".
       "ORDER BY movie_type ";
echo $query;
Gives us:
Code:
SELECT  movie_name,movie_type FROM MOVIEWHERE movie_year>1990 ORDER BY movie_type
See the missing space? So, try:
Code:
$query="SELECT  movie_name,movie_type ".
       "FROM MOVIE ". // <-- extra space here
       "WHERE movie_year>1990 ".
       "ORDER BY movie_type ";
echo $query;
And we get:
Code:
SELECT  movie_name,movie_type FROM MOVIE WHERE movie_year>1990 ORDER BY movie_type
HTH
Charlie

--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk