magnetica Posted May 12, 2007 Share Posted May 12, 2007 Hi Heres an example of what im trying to do: SELECT * FROM [i]table [/i] WHERE [i]row [/i] = '*' So basically im trying to use the WHERE clause to get all rows. Is this possible? Quote Link to comment https://forums.phpfreaks.com/topic/51055-select-question/ Share on other sites More sharing options...
bubblegum.anarchy Posted May 12, 2007 Share Posted May 12, 2007 To get all the rows of a table simply use: SELECT * FROM table Quote Link to comment https://forums.phpfreaks.com/topic/51055-select-question/#findComment-251246 Share on other sites More sharing options...
magnetica Posted May 12, 2007 Author Share Posted May 12, 2007 I already know this, but I need to use the WHERE Ok heres my situation. I have a drop down menu with the values Any, Action, Arcade etc Now when someone clicks for example Action then the query would be: SELECT * FROM table WHERE row = 'action' Now when someone clicks any then obviously this isn't an actual value in the database so how do I use the WHERE clause to select all/any Quote Link to comment https://forums.phpfreaks.com/topic/51055-select-question/#findComment-251248 Share on other sites More sharing options...
bubblegum.anarchy Posted May 12, 2007 Share Posted May 12, 2007 Consider something like this: mysql_query($query = "SELECT * FROM table".( $_POST['select'] != "Any" ? " WHERE row = '".$_POST['select']."'" : null )); Quote Link to comment https://forums.phpfreaks.com/topic/51055-select-question/#findComment-251255 Share on other sites More sharing options...
fenway Posted May 14, 2007 Share Posted May 14, 2007 You can use WHERE 1=1 as well, but I don't really understand why you ever want all of them. Quote Link to comment https://forums.phpfreaks.com/topic/51055-select-question/#findComment-253072 Share on other sites More sharing options...
bubblegum.anarchy Posted May 15, 2007 Share Posted May 15, 2007 or WHERE TRUE Quote Link to comment https://forums.phpfreaks.com/topic/51055-select-question/#findComment-253188 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.