thank you martyr...
This PM system is the thing that's messing me up... since it's a chat system, PMs need to be real time...
the "toUser !='' " section is because i don't want it to pull records where there is no toUser (hence, it's a message to the entire chat, not just a specific user)
As for the conversations, they are all stored and kept in the database with the messages to everyone (where toUser = ''), or to a specific user (where toUser != '')... the $row2['chat_logged_in'] limits which messages are pulled, meaning conversations will be pulled from the database, and all ones which are from this current chat session are pulled...
Think of a FlashChat (if you've ever used it... it's from tufat), or an IM conversation... now i'm fairly sure that AIM, MSN, or w/e would store all of the messages that have been made (to some degree)... they pull only certain ones, meaning conversations made before you logged in are not factored into your IM screen, this is where the query has to differentiate...
But as for this query, i'll add AND toUser != '' and see how it works...
EDIT: lol... i think i found the problem >.>;; i grouped by toUser, meaning that since there were 2 messages to me, only one was taken because the other was grouped with it...
SO, now I just need one to mark the amount of conversations... any suggestions? or maybe i can edit this one somehow?
php
mysql_query("SELECT COUNT(toUser) AS total,fontColor,bold,italics,poster,
message,toUser,id FROM flex_chat_messages WHERE time >= '$row2[chat_logged_in]'
AND (toUser='$username' OR poster='$username') AND toUser != ''
GROUP BY id ORDER BY id,poster,toUser")or die(mysql_error());EDIT2: in a fit of genius earlier, i started thinking that if I put a while in a for, I can get the messages and output them correctly... the only problem with it would be the amount of queries... it would be 1 query for each IM, plus another query to get the list of IMs... now it seems a little excessive, but the second query (the one for each messages), would be like
SELECT * FROM flex_chat_messages WHERE poster = '$username' AND toUser = '$toUser' OR toUser = '$username' AND poster = '$toUser'... it seems just somewhat off to me, like there should be an easier way....
This post has been edited by JBrace1990: 25 Jul, 2008 - 10:23 PM