PHP fetch data and insert into html table -


select date, dayname(date) day , time booking date between curdate() , curdate() + interval 7 day 

after query, return result of day , specific time. query result

and populate date html table.

however, real problem that, when result return more 1 result, populate table according number or result. example

this php code use loop through result ,

function checkhari() {      $sql = "select date, dayname(date) hari , time booking date between curdate() , curdate() + interval 7 day";     $results = mysql_query($sql);     $num_rows = mysql_num_rows($results);      return $results; }  $check_hari = checkhari();   while ($row = mysql_fetch_assoc($check_hari)) {  <?php if( $hari = 'wednesday' ) { ?>  <tr>  <td>wednesday</td>  <?php if ($time >= 8 && $time < 10) {   echo '<td id="wednesday0810" class="blacked"><small>booked</small></td>';   } else {   echo '<td></td>';   } ?>  <?php if ($time >= 10 && $time < 12) {   echo '<td id="wednesday1012" class="blacked"><small>booked</small></td>';   } else {   echo '<td></td>';   } ?>  <?php if ($time >= 12 && $time < 14) {   echo '<td id="wednesday1214" class="blacked"><small>booked</small></td>';   } else {   echo '<td></td>';   } ?>  <?php if ($time >= 14 && $time < 16) {   echo '<td id="wednesday1416" class="blacked"><small>booked</small></td>';   } else {   echo '<td></td>';   } ?>  <?php if ($time >= 16 && $time < 18) {   echo '<td id="wednesday1618" class="blacked"><small>booked</small></td>';   } else {   echo '<td></td>';   } ?> </tr> 


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -