What I want to do is display the routineName and description when the user logged into my system based on what they userID or username is.
I have 3 tables in mySQL database user userid name username password
Routine RoutineID RoutineName Description
UserRoutines UserRoutinesID userid RoutineID
This is my Query So far SELECT routine
.RoutineName
, routine
.Description
FROM user_routines
, routine
, userdetails
Where 'user_routine'.'userid' = 'user'.'userid' AND 'user'.username = username = ?; (? is the variable passed from the application)
SELECT RoutineName, Description
FROM Routine r , UserRoutines ur
WHERE r.RoutineID = ur.RoutineID
AND userid = ?
Bind this request with your userID which you can stock when connecting in $_SESSION
variable :
session_start();
$_SESSION['userid'] = the user id
Note : you can store username instead of userid, you'll just have to add another table to your statement.
You should be more specific with your questions, this is not a "do this for me" site.
Basically you should try something like SELECT maintable.field1, table1.field1, table2.field1 FROM MainTable INNER JOIN table1 ON table1.id = Maintable.id_table1 INNER JOIN table2 INNER JOIN table2.id = Maintable.id_table2 WHERE Maintable.field1 = ?