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? 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 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 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 )); 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. 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 Link to comment https://forums.phpfreaks.com/topic/51055-select-question/#findComment-253188 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.