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"; Link to comment https://forums.phpfreaks.com/topic/260893-help-with-a-join/ 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. Link to comment https://forums.phpfreaks.com/topic/260893-help-with-a-join/#findComment-1337188 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! Link to comment https://forums.phpfreaks.com/topic/260893-help-with-a-join/#findComment-1337191 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.