Forum Moderators: open
I am a novice to PHP and seem to be scraping through my code constantly. I am getting unpredictable results at times with my queries so I am trying to use a join if possible.
Can somone please tell me what the best way to query the following:
I have 3 tables, each table has some info that I need:
tbl_messages has the messageID
tbl_clients has the clients details
tbl_login has the clients sub-client id
My current query is:
$userid= $_SESSION_VARS['iuid'];
SELECT *
FROM tbl_messages, tbl_clients, tbl_login
WHERE msgto = 'userid' AND tbl_clients.clientid = tbl_messages.msgfrom AND tbl_messages.msgfrom = tbl_login.loginid
But I'm sure it's not the best way of doing this?
Any help would be much appreciated, I tried the 'join' command but struggled joining the tables.
Thanks in advance,
JJ