My rebuild of the Private Message System works fine. Now I am trying to show, in a table, all messages by their user_name.
<?php // Obtain the amount of users in users $query_users = mysql_query("SELECT * FROM users") $num_users = mysql_num_rows("$query_users"); // Obtain the amount of messages in conversations_messages $query_messages = mysql_query("SELECT * FROM conversations_messages"); $num_messages = mysql_num_rows($query_messages); // Create a loop where the limit is the amount of messages stored in the `conversations_messages`table $i=0; while ($i<=$num_messages){ // Now, it needs to display all the messages by the user_name. //This is the part that I do not understand } ?>This should return :
Charles : Message1 (the date the message was sent)
Charles : Message2 (the date the message was sent)
Charles : Message3 (the date the message was sent)
Adam : Message1 (the date the message was sent)
Adam : Message2 (the date the message was sent)
Adam : Message3 (the date the message was sent)
Adam : Message1 (the date the message was sent)
George : Message1 (the date the message was sent)
George : Message2 (the date the message was sent)
and so on.
Thanks for any help! I couldn't figure this out on my own.