Possible Duplicate:
Print Y-m-d list of business dates between two dates from MySQL using PHP
I'm new to these kind of PHP programming so bear with me.
I want users to be able to post two dates, a startdate and a enddate and from these dates calculate the business dates (exclude Saturday and Sunday) and insert these to MySQL
For example if I have this form...
<form action='update.php' method='post'>
<input type='text' name='start_date'>
<input type='text' name='end_date'>
<input type='submit' name='submit'>
</form>
update.php
if(isset($_POST['submit'])) {
$start_date = $_POST['start_date']; //Let's say this is 2012-10-01
$send_date = $_POST['end_date']; //Let's say this is 2012-10-10
}
Now I would like to loop through the dates and create a MySQL query that would run like this:
INSERT INTO tbl_dates (date_value) VALUES ('2012-10-01');
INSERT INTO tbl_dates (date_value) VALUES ('2012-10-02');
INSERT INTO tbl_dates (date_value) VALUES ('2012-10-03');
INSERT INTO tbl_dates (date_value) VALUES ('2012-10-04');
INSERT INTO tbl_dates (date_value) VALUES ('2012-10-05');
INSERT INTO tbl_dates (date_value) VALUES ('2012-10-08');
INSERT INTO tbl_dates (date_value) VALUES ('2012-10-09');
INSERT INTO tbl_dates (date_value) VALUES ('2012-10-10');
I know this is probably not a good solution but it's how I need it.
How do I create the loop?