"Matt C" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 1) I would like to pull all entries out of a table that have dates that
> haven't occured yet. Basically forget anything before the current day. How
> do I do that?
DELETE FROM table WHERE timestamp > $now
> 2) I enter news into a table and would like to display a summary page.
> Basically it has a list of headlines under the date they were added.
>
> Monday 10th August
> *Item 1
> *Item 2
>
> Tuesday 11th August
> *Item 1
>
> etc....
>
> How do I do that?
This is a wildly recurrent question, which really should be in
the FAQ if it's not already (hint, hint...)
Note: this is very PHP-like pseudocode; it
WILL NOT run "as written".
// The query MUST BE sorted by the listby field,
// so that equal values will end up together.
$query =
"SELECT listbyfield, fieldB [, fieldC etc...] "
."FROM table ORDER BY listbyfield";
$res = mysql_query($query);
$lastseen = "";
while ($row = mysql_fetch_array($res)) {
// only echo the listby field if the value changes
if ($row["listbyfield"] != $lastseen) {
$lastseen = $row["listbyfield"];
printNewHeader($lastseen);
}
printEntry();
}
... you will of course have to define
suitable stuff for printNewHeader()
and printEntry().
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]