I have four tables and I want to join all of them. I have successfully joined 3 tables, but when I try to join the fourth one, it doesn't work. I have set error_reporting(E_ALL);
and add or die(mysqli_error($con));
to the end of my query but it doesn't show any errors, just a white screen.
It stopped working when I tried to join the votes table.
My tables are votes
users
rings
posts
Here is my query:
$sql = mysqli_query($con, "SELECT * FROM posts p
INNER JOIN rings r ON p.rid = r.id
INNER JOIN users u ON p.uid = u.id
INNER JOIN votes v ON p.pid = v.pid
WHERE p.rid IN ('$rja') AND p.uid != '$uid'
AND p.deleted = '0'
ORDER BY p.date_posted DESC"
) or die(mysqli_error($con));
$rja
is an array.
Votes Table:
vid | pid | uid | vote_type
Users Table:
id | username | password | email
Posts Table:
pid | uid | rid | body | votes | deleted | date_posted
Rings Table:
id | title | category | rating | user_created
If you have any questions please comment