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
https://forums.phpfreaks.com/topic/213168-problem-combining-tables/
Share on other sites

  Quote

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

 

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.

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.