Michdd Posted November 23, 2008 Share Posted November 23, 2008 How do I use a MySql Query that selects from the database where 2 separate things hold true. Link to comment https://forums.phpfreaks.com/topic/133875-solved-mysql-select-where-something-something-else/ Share on other sites More sharing options...
redarrow Posted November 23, 2008 Share Posted November 23, 2008 Trie this from a database but using 2 tables and field_names. <?php // database connection... $sql="select * from table1 as a,table2 as b where a.what_ever='true' and b.what_ever='true'"; $res=mysql_query($sql)or die(mysql_error()); while($data=mysql_fetch_assoc($res)){ echo $data['what_ever']; } ?> Link to comment https://forums.phpfreaks.com/topic/133875-solved-mysql-select-where-something-something-else/#findComment-696883 Share on other sites More sharing options...
Michdd Posted November 23, 2008 Author Share Posted November 23, 2008 Trie this from a database but using 2 tables and field_names. <?php // database connection... $sql="select * from table1 as a,table2 as b where a.what_ever='true' and b.what_ever='true'"; $res=mysql_query($sql)or die(mysql_error()); while($data=mysql_fetch_assoc($res)){ echo $data['what_ever']; } ?> I want to do something that will select something from the DB where a name='something' and somethingelse>'29' Link to comment https://forums.phpfreaks.com/topic/133875-solved-mysql-select-where-something-something-else/#findComment-696885 Share on other sites More sharing options...
corbin Posted November 23, 2008 Share Posted November 23, 2008 SELECT * FROM table WHERE name = 'something' AND somethingelse > 29; Link to comment https://forums.phpfreaks.com/topic/133875-solved-mysql-select-where-something-something-else/#findComment-696887 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.