Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Natasha . Check this out! You ll surely surprise :)</p> <pre><code>function dates_between($emp_id,$start_date, $end_date = false) { $qsdate=$start_date; $qedate=$end_date; //echo $start_date.$end_date; if ( !$end_date ) { $end_date = date("Y-m-d"); } $start_date = is_int($start_date) ? $start_date : strtotime($start_date); $end_date = is_int($end_date) ? $end_date : strtotime($end_date); $test_date = $start_date; $day_incrementer = 1; $count_leaves=0; $flag=0; $work_res = mysql_query("SELECT DISTINCT date FROM `work_details` WHERE employee_id='".$emp_id."' and date between '".$qsdate."' and '".$qedate."'"); while($row=mysql_fetch_array($work_res)) { while((date("Y-m-d",$test_date)&lt;$row['date'])&amp;&amp;($flag=0)) { if(!(date('N', strtotime(date("Y-m-d", $test_date))) &gt;= 6)) { echo "&lt;tr&gt;&lt;td align=center class=fontclass style=color:FF0000&gt;".date("Y-m-d", $test_date)."&lt;/td&gt;&lt;/tr&gt;"; $count_leaves++; } $test_date = $test_date + ($day_incrementer * 60 * 60 * 24); } $flag=1; while((date("Y-m-d",$test_date)!=$row['date'])) { if(!(date('N', strtotime(date("Y-m-d", $test_date))) &gt;= 6)) { echo "&lt;tr&gt;&lt;td align=center class=fontclass style=color:FF0000&gt;".date("Y-m-d", $test_date)."&lt;/td&gt;&lt;/tr&gt;"; $count_leaves++; } $test_date = $test_date + ($day_incrementer * 60 * 60 * 24); } $test_date = $test_date + ($day_incrementer * 60 * 60 * 24); } while ( date("Y-m-d", $test_date) &lt;= date("Y-m-d", $end_date)) { if(!(date('N', strtotime(date("Y-m-d", $test_date))) &gt;= 6)) { echo "&lt;tr&gt;&lt;td align=center class=fontclass style=color:FF0000&gt;".date("Y-m-d", $test_date)."&lt;/td&gt;&lt;/tr&gt;"; $count_leaves++; } $test_date = $test_date + ($day_incrementer * 60 * 60 * 24); } return($count_leaves); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload