SirChick Posted August 14, 2007 Share Posted August 14, 2007 I'm trying to load up data where by the session is carrying the user ID.. and i need the session to call up the user table which is working fine. But i also need to call up info about gangs that the user is in. Now it gets complicated cos the user could be 1 of 30 members (30 being the max a gang gang can have). But how is this done? This is what i got at the moment. But this is only calling up the one table. I need this now to also check if the user ID is in another table which could be in a possible 30 fields. $GetUserID = mysql_query("SELECT * FROM userregistration WHERE UserID='{$_SESSION['Current_User']}'"); // Fetch the row from the database if (!($row = mysql_fetch_assoc($GetUserID))) { echo "User not found!"; exit; } // Display user's info $UserId = $row["UserID"]; $HandMoney = $row["MoneyInHand"]; In the "gangs" table there is this: Member1 Member2 And so on right up to Member30. The user could be in any of these 30 fields.. once it finds that it needs to be able to then fetch it and then be able to display it like shown in the above code. There is no echo how ever but thats cos this is an "include". The echo's are on the html files which is separate. Quote Link to comment https://forums.phpfreaks.com/topic/64871-session-to-query-multiple-tables-fields/ Share on other sites More sharing options...
trq Posted August 14, 2007 Share Posted August 14, 2007 May I suggest you look into some database normalization tutorials, having the fields Member1, member2 etc etc is a pretty poor design which will make you queries much more difficult and less efficient. While your at it, find some tutorials on joins in mysql, this will help you format your queries. Quote Link to comment https://forums.phpfreaks.com/topic/64871-session-to-query-multiple-tables-fields/#findComment-323677 Share on other sites More sharing options...
SirChick Posted August 14, 2007 Author Share Posted August 14, 2007 is it difficult to learn? im not too street wise with this stuff.. Quote Link to comment https://forums.phpfreaks.com/topic/64871-session-to-query-multiple-tables-fields/#findComment-323679 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.