zelig Posted April 13, 2012 Share Posted April 13, 2012 I'm trying to pull from my database every spell or attack that is equal to `All`, but it doesn't seem to be working. All it is doing is pulling all the spells, regardless of class = `All`, and also 0 of the attacks. It should be producing a single attack that is = to `All` as no spells are = `All`. Any help would be greatly appreciated! Thanks! (This is my first attempt at a JOIN statement...) $query = "SELECT attacks.id, attacks.name, attacks.price, attacks.class, attacks.descript, spells.id, spells.name, spells.price, spells.class, spells.descript ". "FROM attacks, spells ". "WHERE attacks.class = 'All' || spells.class = 'All' order by attacks.name, spells.name asc"; Quote Link to comment Share on other sites More sharing options...
samshel Posted April 13, 2012 Share Posted April 13, 2012 1) this is not a PHP question but rather a MySQL question 2) $query = "SELECT attacks.id, attacks.name, attacks.price, attacks.class, attacks.descript, spells.id, spells.name, spells.price, spells.class, spells.descript FROM attacks, spells WHERE attacks.class = 'All' OR spells.class = 'All' order by attacks.name, spells.name asc"; mysql($query) or die(mysql_error());//will show if there is any error in the query 3) Echo the query and fire manually on database to see if it returns any result. without knowing the data in the tables and structure of the tables, i am afraid i cannot help you more. Quote Link to comment Share on other sites More sharing options...
zelig Posted April 13, 2012 Author Share Posted April 13, 2012 Yeah, it's not doing exactly what I want. There's no error in it. I'll move this along to a mysql help. Thanks! Quote Link to comment 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.