Lv-Kris Posted March 25, 2007 Share Posted March 25, 2007 Ok, hers the situation: Here are some of mine tables: user data, user_weapons, game_weapons The idea is to store only the weapon_id and amount of those user has in the user_weapons table. Then its linked to game_weapons, where we get weapon details from. Well i need a little help on joining them all together... For example user attacks other user with his weapon, he chooses the weapon id and the amount of damage depends on the weapon stats stored in game_weapons table. I am willing to do this because of easier modifying later Hope You got the idea. Kris Quote Link to comment Share on other sites More sharing options...
btherl Posted March 26, 2007 Share Posted March 26, 2007 SELECT * FROM user_data JOIN user_weapons ON (user_data.user_id = user_weapons.user_id) JOIN game_weapons ON (user_weapons.weapon_id = game_weapons.weapon_id) WHERE user_id = $user_id That's the basic structure for a join. Quote Link to comment Share on other sites More sharing options...
Lv-Kris Posted March 30, 2007 Author Share Posted March 30, 2007 Thank You for the reply. When I try to echo the result of query, it just shows Resource id #29 Any suggestions? Kris Quote Link to comment Share on other sites More sharing options...
Waldir Posted March 30, 2007 Share Posted March 30, 2007 that measn you have more than one row as a result and each row is an array, you have to make a loop to echo each row for ($i = 0; $i < mysql_num_rows($result); $i++) { $row[$i] = mysql_fetch_assoc($result); print_r($row[$i]); } result being the result of your query (wich is what gives you Resource id #29) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.