$btresult = mysql_query("SELECT username, date, time FROM blog WHERE username IN ('$friends') GROUP BY username ORDER BY id DESC");
while($btarray = mysql_fetch_assoc($btresult))
{
$thetime = $btarray['date'].' at '.$btarray['time'];
$btime[$btarray['username']] = $thetime;
}
print_r($btime);
My problem is that no matter how I ORDER BY in the query, the date and time selected is always from the first row, not the last (as indicated by the order by id DESC).
I believe that the problem is in the GROUP BY part. I tried taking that out, and it didn't return anything.
Any help?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
For example it should be showing the last date as October 9th, 2005 at 3:19 PM (the latest entry), instead it says January 26th, 2005 at 3:44 AM (the first entry).
$btresult = mysql_query("SELECT id, username, date, time FROM blog WHERE username IN ('$friends') GROUP BY username ORDER BY id DESC");
while($btarray = mysql_fetch_assoc($btresult))
{
$thetime = $btarray['date'].' at '.$btarray['time'];
$btime[$btarray['username']] = $thetime;
}
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Since the id field is incremented with each entry, the ORDER BY id DESC would find the latest date entry.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.