grahamb314 Posted September 15, 2008 Share Posted September 15, 2008 Hi all, I`m looking for a query that Selects all from table where field = 'thistext' AND field2 = 'thistext2 AND field3 = 2thistext3' I hope you get what I mean! Quote Link to comment https://forums.phpfreaks.com/topic/124362-solved-very-small-php-sql-problem/ Share on other sites More sharing options...
Maq Posted September 15, 2008 Share Posted September 15, 2008 SELECT * FROM table WHERE field = 'thistext' AND field2 = 'thistext2 AND field3 = 'thistext3' Quote Link to comment https://forums.phpfreaks.com/topic/124362-solved-very-small-php-sql-problem/#findComment-642266 Share on other sites More sharing options...
grahamb314 Posted September 15, 2008 Author Share Posted September 15, 2008 SELECT * FROM table WHERE field = 'thistext' AND field2 = 'thistext2 AND field3 = 'thistext3' As simple as that! - I`ll give it a try thanks Quote Link to comment https://forums.phpfreaks.com/topic/124362-solved-very-small-php-sql-problem/#findComment-642268 Share on other sites More sharing options...
realjumper Posted September 15, 2008 Share Posted September 15, 2008 I'm not exactly sure what you mean but: // Retrieve all the data from the table $result = mysql_query("SELECT * FROM table WHERE field = 'thistext' && field2 = 'thistext2' && field3 = 'thistext3'") or die(mysql_error()); // store the record of the table into $row $row= mysql_fetch_array( $result ); Quote Link to comment https://forums.phpfreaks.com/topic/124362-solved-very-small-php-sql-problem/#findComment-642273 Share on other sites More sharing options...
Maq Posted September 15, 2008 Share Posted September 15, 2008 That just grabs and stores all the info. If you want to display something then you have to go off of what realjumper posted. Let me know if that's what you want to do. Quote Link to comment https://forums.phpfreaks.com/topic/124362-solved-very-small-php-sql-problem/#findComment-642276 Share on other sites More sharing options...
grahamb314 Posted September 15, 2008 Author Share Posted September 15, 2008 Thanks everyone for your input, I didnt know AND is the same as && in php, Works a treat! Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/124362-solved-very-small-php-sql-problem/#findComment-642309 Share on other sites More sharing options...
Maq Posted September 16, 2008 Share Posted September 16, 2008 Glad I could help Quote Link to comment https://forums.phpfreaks.com/topic/124362-solved-very-small-php-sql-problem/#findComment-642561 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.