AdrianR Posted March 10, 2006 Share Posted March 10, 2006 hi guys.I have a little trouble with the select statement.I mean I have a table named 1 and in the table I have 5 fields named "a""b""c""d""e".How can I select the content of the field "a" but only if the content of field b is "test" and the content of field c is "more test"?:( can`t find the answer..SELECT a from dbname where b like 'test' and c like 'more test' dosen`t seem to work Quote Link to comment https://forums.phpfreaks.com/topic/4634-select-statement/ Share on other sites More sharing options...
php_b34st Posted March 10, 2006 Share Posted March 10, 2006 Try:[code]$sql = mysql_query("SELECT a FROM 1 WHERE b='test' AND c='more test'");[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4634-select-statement/#findComment-16216 Share on other sites More sharing options...
AdrianR Posted March 10, 2006 Author Share Posted March 10, 2006 hmm,,yes...it works.thanks a lot :) Quote Link to comment https://forums.phpfreaks.com/topic/4634-select-statement/#findComment-16217 Share on other sites More sharing options...
AdrianR Posted March 10, 2006 Author Share Posted March 10, 2006 :( oh no,it dosen`t work.i was misstaking.the script dosen`t return any information Quote Link to comment https://forums.phpfreaks.com/topic/4634-select-statement/#findComment-16228 Share on other sites More sharing options...
redarrow Posted March 10, 2006 Share Posted March 10, 2006 [quote name='adrianR' date='Mar 10 2006, 09:16 PM' post='353726']:( oh no,it dosen`t work.i was misstaking.the script dosen`t return any information[/quote]Try thisgood luck[code]$sql = mysql_query("SELECT a FROM 1 WHERE b='test' || c='more test'");[/code]or[/quote][code]$sql = mysql_query("SELECT a FROM 1 WHERE b='test' && c='more test'");[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4634-select-statement/#findComment-16235 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.