smartin1017 Posted May 6, 2008 Share Posted May 6, 2008 I am running into a syntax error. I know this is right but it wont work. I have a table called 'dark_hunter', in that table i have a cloumn called 'book_title'. When someone clicks the image bookcover (there are seven bookcovers on the page) it brings them to the 'bookdisplay' page where the book title and series is appended to the URL, I $_GET them and use that in my DB query. This is my query $result = mysql_query("SELECT * FROM $bookseriesfordisplay WHERE book_title = `$booktitlefordisplay`") $bookseriesfordisplay is the series and $booktitlefordisplay is the title. I know these work because I did a little checking and echoed them out so I know the correct info is passing. Here is the error.. Unknown column 'dragonswan' in 'where clause' dragonswan is the book_title passed over the URL. Any ideas? Quote Link to comment Share on other sites More sharing options...
paul2463 Posted May 6, 2008 Share Posted May 6, 2008 try this $result = mysql_query("SELECT * FROM '$bookseriesfordisplay' WHERE book_title = '$booktitlefordisplay'"); it is saying that in the table there is no book_title called 'dragonswan', i have placed single ticks around the php variables because they have to have that for the query to work and you didnt have any around the FROM variable Quote Link to comment Share on other sites More sharing options...
smartin1017 Posted May 6, 2008 Author Share Posted May 6, 2008 I just tried it, didnt work. Its killing me because I know it all right. Any other ideas Quote Link to comment Share on other sites More sharing options...
fenway Posted May 6, 2008 Share Posted May 6, 2008 You want single quotes around your string literal, not back-ticks: $result = mysql_query("SELECT * FROM $bookseriesfordisplay WHERE book_title = '$booktitlefordisplay'") Quote Link to comment Share on other sites More sharing options...
smartin1017 Posted May 6, 2008 Author Share Posted May 6, 2008 Thats exactly it. Man I was looking at this thing all day, its always the little things. Thanks!! 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.