bobocheez Posted November 26, 2009 Share Posted November 26, 2009 How would you format the following so that a row that has both $season and $show in it? $query = "SELECT * FROM episodes WHERE season_no='$season' AND WHERE show='$show'"; Quote Link to comment https://forums.phpfreaks.com/topic/182977-sql-select-where-and-where/ Share on other sites More sharing options...
rotc_rachel Posted November 26, 2009 Share Posted November 26, 2009 I don't believe you need the second 'WHERE' in there Quote Link to comment https://forums.phpfreaks.com/topic/182977-sql-select-where-and-where/#findComment-965802 Share on other sites More sharing options...
bobocheez Posted November 26, 2009 Author Share Posted November 26, 2009 I tried without the second where and it did not work. Quote Link to comment https://forums.phpfreaks.com/topic/182977-sql-select-where-and-where/#findComment-965809 Share on other sites More sharing options...
jamesxg1 Posted November 26, 2009 Share Posted November 26, 2009 You dont. That is a wrong query. $query = "SELECT * FROM `episodes` WHERE season_no = '$season' AND show = '$show'"; That will work if you are querying it properally. James. Quote Link to comment https://forums.phpfreaks.com/topic/182977-sql-select-where-and-where/#findComment-965812 Share on other sites More sharing options...
bobocheez Posted November 26, 2009 Author Share Posted November 26, 2009 That would normally work, but show turns out to be a command of some sort....so it gives out a syntax error "Definition: The show tables SQL command is used to display all of the tables in a MySQL database and is phrased as: show tables; Examples: This would list all of the tables in your database: show tables;" -By Angela Bradley, About.com Guide So all is needed here is a change in column name. Thanks for trying. Quote Link to comment https://forums.phpfreaks.com/topic/182977-sql-select-where-and-where/#findComment-965834 Share on other sites More sharing options...
EchoFool Posted November 26, 2009 Share Posted November 26, 2009 You can just put show to `show` and that'll also solve the issue. Quote Link to comment https://forums.phpfreaks.com/topic/182977-sql-select-where-and-where/#findComment-965840 Share on other sites More sharing options...
bobocheez Posted November 26, 2009 Author Share Posted November 26, 2009 Oh, I didn't know that. Thanks. Works like a charm. Quote Link to comment https://forums.phpfreaks.com/topic/182977-sql-select-where-and-where/#findComment-966001 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.