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! 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' 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 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 ); 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. 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 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 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
Archived
This topic is now archived and is closed to further replies.