我正在为大家建立一个网站。 我希望有一个这样的名单。
Saturday 10/22/2011 (header)
Product title 1-city - 100$
产品名称 2-city - 74$
产品标题 3-city - 500美元
www.un.org/Depts/DGACM/index_spanish.htm 星期日 10/23/2011(标题)
产品标题 4-city - 150$
产品所有权 5-城市 - 220美元
产品标题 6-city - 10$
My code is ordering the list perfectly from newest to the oldest but I want to add something to the while loop to print out the headers (which are in bold) like (Saturday 10/22/2011). Basically i want to group the lists under the name of the day they were posted on here is my code:
$sql = "SELECT post_id,city, title, price, imgurl FROM md_post WHERE category= $cat AND city= $city ORDER BY timeStamp desc";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
echo "<a href= adid.php?id=".$row[ post_id ]." >". $row[ title ]. " - ". $row[ price ]." - ".$row[ city ]."</a>";
}