I use a script get dates between a period of time giving the starting and the ending date into something like this: Day1 2011-06-11 Day2 2011-06-12 Day3 2011-06-13 What I want to know is , to get the results into mysql since the data comes from a non mysql query. Here is my code: $current_date = strtotime('2011-02-01'); $end_date = strtotime('2011-02-07'); $day_count = 0; $current_week = null; do { if ((int)($day_count / 7) + 1 != $current_week) { $current_week = (int)($day_count / 7) + 1; echo '<b>'.'week-'.$current_week.'</b>'.'<br />'; } // echo date('Y-m-d', $current_date).'<br />'; $current_date = strtotime('+1 day', $current_date); $day_count ++; $current_day = (int)($day_count); echo '<b>'.'Day-'. $current_day.'</b>'. ' ( '. date( 'Y-m-d', $current_date -1).')'.'<br />'; $totalDays = ''; } while ($current_date <= $end_date); The output sometimes becomes long and I want to insert the data into mysql and then query it for a later work.