Jump to content

Help with a Join


zelig

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.