Jump to content

[SOLVED] Help with query


SirChick

Recommended Posts

I have a query which is loading up all users that a particular ID has messaged or been messaged from.....but its checking this over 3 tables.. i gave it a go but i got an error.. was hoping you'd be able to help me:

My Error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF(Sender='78', Receiver, Sender) as otherPartyID FROM messages UNION SELECT' at line 1

Code:

<?php
$GetConversation = mysql_query("SELECT * IF(Sender='$ID', Receiver, Sender) as otherPartyID 
FROM messages
UNION
SELECT * IF(Sender='$ID', Receiver, Sender) as otherPartyID
FROM textmessages
UNION
SELECT * IF(Sender='$ID', Receiver, Sender) as otherPartyID
FROM phonecalls WHERE Sender='$ReportedPlayer' OR Receiver='$ReportedPlayer'
GROUP BY otherPartyID
")
or die(mysql_error());
?>

Link to comment
https://forums.phpfreaks.com/topic/82977-solved-help-with-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.