Welcome to WebmasterWorld Guest from 54.167.85.221

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Multiple where clauses in select statement

     

dkin

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

10+ Year Member



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());

coopster

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

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



Are you asking if you can have ANDs and ORs in your WHERE clause? Yes, absolutely.

Habtom

7:48 am on Apr 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



//$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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month