It looks like you are selecting fromname, datetime, message, fromid from the table mess. By guessing as to which columns belong to which tables I would say you are looking for something along the lines of:
Code:
SELECT mess.fromname,mess.datetime,mess.message,mess.fromid
FROM mess,friends WHERE mess.toid=$fsnid OR mess.toid='9223372036854775807'
AND mess.status='a' AND friends.friendsid=NULL AND mess.messtype='c'
ORDER BY mess.toid ASC LIMIT 30
you could also write this as
Code:
SELECT mess.fromname,mess.datetime,mess.message,mess.fromid
FROM friends
LEFT JOIN mess
ON mess.toid=$fsnid OR mess.toid='9223372036854775807'
AND mess.status='a'
AND friends.friendsid=NULL
AND mess.messtype='c'
ORDER BY toid ASC LIMIT 30
Bookmarks