RE: [PHP-DB] I am really stuck

From: Date: Fri, 24 Aug 2001 18:19:50 +0000
Subject: RE: [PHP-DB] I am really stuck
Groups: php.db 
Request: Send a blank email to php-db+get-11813@lists.php.net to get a copy of this message
I don't believe anybody answered this, but here's an option: 1) Assumes table "mytable" has defined a field as: article_date date. The following will purge anything before today. $query = "DELETE FROM mytable WHERE article_date < ".date("Y-m-d",time()); 2) $query = "SELECT DISTINCT article_date FROM mytable ORDER BY article_date"; $result = mysql_query($query) or die("Error message"); while( $ddrec = mysql_fetch_array($result)) { $dd = $ddrec['article_date']; print $dd; # you'll have to format this date print statement $query = "SELECT * FROM mytable WHERE article_date = $dd"; $dresult = mysql_fetch_array($query) or die("error message"); while( $irec = mysql_fetch_array($dresult) ) { print $irec['item_text']."<BR>"; } mysql_free_result($dresult); } mysql_free_result($result); May require some additional tweaking -----Original Message----- From: Matt C [mailto:matthewcothier@hotmail.com] Sent: Thursday, August 23, 2001 6:36 PM To: php-db@lists.php.net Subject: [PHP-DB] I am really stuck I am extremely stuck with trying to do two things. 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? 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? Any help much appreciated, Thanks, Matt _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#11813) next »