Welcome to WebmasterWorld Guest from 54.234.244.30

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Multiple where clauses in select statement

     
1:57 am on Apr 24, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Mar 4, 2004
posts:553
votes: 0


Just wondering if there is any way to pull this off.

$query = "SELECT * FROM magic where race = $row[race] and class = $row[class] and level <= $row[level] order by spell asc";
$maresult = mysql_query($query) or die(mysql_error());

4:26 am on Apr 24, 2006 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12533
votes: 0


Are you asking if you can have ANDs and ORs in your WHERE clause? Yes, absolutely.
7:48 am on Apr 24, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 15, 2004
posts:1867
votes: 0


//$query = "SELECT * FROM magic where race = $row[race] and class = $row[class] and level <= $row[level] order by spell asc";

You might need to put it this way:

$query = "SELECT * FROM magic where race = '". $row[race] ."' and class = '". $row[class] ."' and level <= '". $row[level] ."' order by spell asc";

Habtom

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members