Re: Select news based on dates
| From: | Mikhail U. Petrov | Date: | Mon, 17 May 2004 13:43:57 +0000 |
| Subject: | Re: Select news based on dates | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34456@lists.php.net to get a copy of this message | ||
Hi!
You can use "order by date" and such method:
<code>
$result = mysql_query(blablabla);
$date = "foo";
while($news = mysql_fetch_array($result)){
if ($date==$news["date"]){
echo "new date";
}
echo $news["text"];
$date = $news["date"];
}
Monday, May 17, 2004, 3:50:04 PM, T. wrote:
THG> Hello,
THG> I would like to display my news like this:
THG> *10.04.2004.*
THG> - news 1
THG> - news 2
THG> - news 3
THG> *14.04.2004.*
THG> - news 4
THG> *15.04.2004.*
THG> - news 5
THG> ...
THG> I'm thinking of some while loop but I'm not sure that it will work nor I
THG> know how to create that query.
THG> TNX
--
Best regards,
Mikhail U. Petrov
mailto:mikhail@begun.ru