PDA

View Full Version : Showing data from 2 tables


misterfade
25 Jan 2006, 15:42
I need help with some code. I have a special usergroup that only they can access a certain page. I want to set it up so that when they login, it displays their info from the USER table, and a custom table I created called TEST. Here's what I have so far:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



So basically I need to match their ID from the TEST table to the USER table, and display the relevant data. I know it's probably something simple, it's just that the Vbulletin query tags are screwing me up lol.

Thanks.

Andreas
25 Jan 2006, 16:01
I've left out the user table as this info is already available in $vbulletin->userinfo, so the JOIN is avoided -> lighter query.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Also, if there is only one record for ewach userid it could be simpilified to


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

misterfade
25 Jan 2006, 16:18
Beautiful! It works great now. Thanks.