homepage Welcome to WebmasterWorld Guest from 54.167.185.110
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Multiple where clauses in select statement
dkin




msg:1296170
 1:57 am on Apr 24, 2006 (gmt 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());

 

coopster




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

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

Habtom




msg:1296172
 7:48 am on Apr 24, 2006 (gmt 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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved