mohamad mohamad mohamad mohamad - 1 year ago 61
PHP Question

how to print all date for a mont or more

i want to print all date from today to specific day this specific day will be taken from database

$sql=mysqli_query($conn,"select * from tbl_activities where db_id='$id'")or die(mysqli_error($conn));

this code give me number of date example 10 days
i want to print date from today to 13 days



output will be like this

Thursday 21st of July 2016
Friday 22st of July 2016
23st of July 2016
24st of July 2016
25st of July 2016
26st of July 2016
27st of July 2016
28st of July 2016
29st of July 2016
30st of July 2016
31st of July 2016
1st of August 2016

Answer Source

try my edited code.


$start_day = strtotime(date("Y-m-d"));
$end_day = $start_day + 86400 * $day;

    while($end_day >= $start_day){
            echo date("j F, Y",$start_day)."\r\n";
            $start_day = $start_day + 86400;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download