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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.