Generate automatic list of dates
| From: | Tommi Virtanen | Date: | Tue, 02 Dec 2003 08:57:38 +0000 |
| Subject: | Generate automatic list of dates | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-171548@lists.php.net to get a copy of this message | ||
Hi!
$first_date = 2003-12-01
$end_date = 2004-01-15
while ( $first_date <= $end_date) {
$sql = "INSERT INTO time_table (id, date, person_id) VALUES (35,$first_date,0)";
$result = mysql_query($sql, $conn);
[next date] WHAT CODE TO HERE????
}
eg.
first insert row is 35, 2003-12-01,0
next should be 35,2003-12-02,0 etc....
...
and last 35,2004-01-15,0