Reputation: 13
I have no idea how to get data from one query with php mysql.
here is my try
$sthpre = mysql_query("SELECT *
FROM users,
file,
friends
WHERE users.id='$other'
AND file.user_id='$other'
AND friends.user_id='$other'",$link) or die("Query failed ");
i need to get for one user id i.e. 32 to get their binded values from other tables.
Upvotes: 0
Views: 143
Reputation: 3520
You can use JOIN to get results from more than one table
SELECT * FROM users
JOIN file ON file.user_id = users.id
JOIN friends ON friends.user_id = file.user_id
WHERE users.id = $other;
Please let me know if it worked
Upvotes: 1