First, I will explain what my code is designed to do.
This part selects all of the contacts (contact_id) on user 1's (my) friend list. It turns them into a single variable, $contacts.
Code:
$query = $DB->query( "SELECT contact_id FROM ibf_contacts WHERE member_id='1'");
while ($row = mysql_fetch_assoc($query)) {
$contacts = $row['contact_id'];
This next part displays all "posts" where the blog IDs (id_blog) are identical to my contacts IDs. In other words, it displays all blog entries of the people on my friends list. It orders them by "id", which is the id of the blog entry. (Chronological order)
Code:
$query2 = $DB->query( "SELECT post FROM mkp_blog_post WHERE id_blog='$contacts' ORDER BY 'id'");
while ($row = mysql_fetch_assoc($query2)) {
echo $row["post"];
}
The problem is that it is not ordering them correctly. For example:
Quote:
Entry 1, Written By Person A
"Hello, How are you!"
Entry 2, Written By Person B
"I am doing fine."
Entry 3, Written By Person A
"What are you doing today?"
Entry 4, Written By Person B
"Not much."
|
The above is the order it
should display in. However, this is how it is actually being displayed:
Quote:
Entry 1, Written By Person A
"Hello, How are you!"
Entry 3, Written By Person A
"What are you doing today?"
Entry 2, Written By Person B
"I am doing fine."
Entry 4, Written By Person B
"Not much."
|
So what it's doing, is ordering them first based on user ID, and THEN based on the ID of the entry. (Which is just another way of saying the chronological order). Also, I did not show this above, because I didn't want to make things confusing, but it is also ordering them from oldest to newest, and not newest to oldest. I'm sure there is a fix for this? Thanks!