Jump to content

Problem combining tables


katarra

Recommended Posts

I'm trying to combine 3 tables (attacks, spells, skills) where it brings in all the information from attacks and spells into the table skills.

 

The common row between all 3 is "name".

 

Here is what I have so far.

 

$query = "SELECT * FROM `skills`,`attacks`,`spells` WHERE (`attacks.name`=`skills.name` OR `spells.name`=`skills.name`) AND `user_id`='".$_SESSION['userid']."'";

 

Thanks!

Link to comment
Share on other sites

I'm having it list available "abilities" that someone can use in a battle script.

 

I don't know of a different way to do it, so that's why I put it like this. I'm still a novice at php.

 

Will one player have all 3? Attacks spells skills? Or are you going to be asking your db to recognize what your player is THEN pull related database. Secondly, is there a 'spellpoint' system. When a player exhausts their spell points...you'll want your code to recognize it and negate use of the attack/spell/skill, yes?

 

Could you tell me the structure of your Databases plz? For what I have in mind..you may need to add a few things to have it function..

 

Link to comment
Share on other sites

A player "could" have spells and attacks, yes. When a player purchases/learns a spell/attack, then the `skills` table gets updated with the following information from that `spells` or `attacks` table: (item_id = the spell or attack id#, name = name of the spell or attack, attacks/spells = whatever the thing being purchased is, and then user_id = the person's unique id# that purchased the spell).

 

There is an "energy" row in `spells` and `attacks` so that when a player expends all of their energy, they can't do any more attacking. There is also a `mp` row in `spells` that is associated with each specific spell, so that when you run out of mp, you can't cast anymore.

 

If you want me to copy/paste exactly what the db tables include, I can do that too.

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.