So if I do this query:
$result1 = mysqli_query($conn, "
SELECT t.author as tauthor
, t.category
, t.title
, t.last_reply
, t.threadID
, t.isLocked
, t.isSticky
FROM threads t
WHERE t.author = '$user'
");
This gives me the desired output.
next i have this query:
$result2 = mysqli_query($conn, SELECT th.author as rauthor,th.category, th.title, th.last_reply,
th.threadID, th.isLocked, th.isSticky
FROM threads th
INNER JOIN replies r
ON th.threadID=r.threadID
WHERE r.author = '$user'");
This also gives me the desired output.
Now I want to combine these queries so that the two queries are extracted together. I tried the following:
$result3 = mysqli_query($conn, "SELECT t.author as tauthor, t.category, t.title, t.last_reply,
t.threadID, t.isLocked, t.isSticky
FROM threads t
UNION ALL
(SELECT th.author as rauthor, th.category, th.title, th.last_reply,
th.threadID, th.isLocked, th.isSticky
FROM threads th
INNER JOIN replies r
ON th.threadID=r.threadID)
WHERE r.author = '$user'AND t.author='$user' ");
This gives me a false output which means its not executing. I'm not sure how to go about getting the combines results of the first two queries into one. Thanks.