I don't know how to use FOR on Wappler

Good night.
I am redesigning my site and have a data and time reservation control.

How can I check this database and load information if the time is available or the time is not available?

On my old site I loop PHP:

 <table width="100%" class="table-1">
                                <tr>
                                    <th width="29"></th>
                                    <th width="50"></th>
                                    <th width="205"></th>
                                </tr>
                                <tr class="bg-1">
                                    <td class="coll-1">&nbsp;</td>
                                    <td class="coll-1"><h6>Hora</h6></td>
                                    <td class="coll-1"><h6>Status</h6></td>
                                </tr>
                                <?php 
								$dia_da_semana = date("w");
								if ($dia_da_semana == 1)
								{
									for($x=0;$x<=23;$x++)
									{
										$hora1 = str_pad($x, 2, '0', STR_PAD_LEFT).':00';
										//$x++;
										//$hora2 = str_pad($x, 2, '0', STR_PAD_LEFT).':59';
										//$hora2 = str_pad($hora2, 2, '0', STR_PAD_LEFT);
									?>
										<tr>
											<td class="coll-1"><img src="images/usado.png" width="16" height="15"></td>
											<td class="coll-1"><?php echo $hora1 ?></td>
											<td class="coll-4">Horário Bloqueado</td>
										</tr>
									<?php
									}
								}
								else
								{
								  // lista os horarios
									for($x=0;$x<=23;$x++)
									{
										$hora1 = str_pad($x, 2, '0', STR_PAD_LEFT).':00';
										//$x++;
										//$hora2 = str_pad($x, 2, '0', STR_PAD_LEFT).':59';
										//$hora2 = str_pad($hora2, 2, '0', STR_PAD_LEFT);
										
										if ($hora1=='00:00' or $hora1=='01:00' or $hora1=='02:00' or $hora1=='03:00' or $hora1=='04:00' or $hora1=='05:00' or $hora1=='06:00' or $hora1=='07:00') 
										{
										?>
                                            <tr>
                                              <td class="coll-1"><img src="images/usado.png" width="16" height="15"></td>
                                              <td class="coll-1"><?php echo $hora1 ?></td>
                                              <td class="coll-4">Horário Bloqueado</td>
                                            </tr>
                                        <?php	
										}
										else
										{
											if(horario_inicial_disponivel_shopping(date('Y-m-d'), $hora1))
											{?>
												<tr>
													<td class="coll-1"><img src="images/livre.png" width="16" height="15"></td>
													<td class="coll-1"><?php echo $hora1 ?></td>
													<td class="coll-3">Disponivel para reserva</td>
												</tr>
										<?php 	 
											} 
											else 
											{ 
														
												$sql = 'SELECT * FROM reservas WHERE 
												data = \''.mysql_real_escape_string(date('Y-m-d')).'\' AND 
												hora_inicial = \''.mysql_real_escape_string($hora1).'\' AND
												empresa = \''.mysql_real_escape_string(1).'\'';
												$res = mysql_query($sql);
												$num = mysql_num_rows($res);
													if ($num>0)
													{
														for($i=0;$i<$num;$i++)
														{
															$status_pagamento = mysql_result($res, $i, 'status');
														}
																	
														if ($status_pagamento == 0)
														{
														?>
															<tr>
																<td class="coll-1"><img src="images/usado.png" width="16" height="15"></td>
																<td class="coll-1"><?php echo $hora1 ?></td>
																<td class="coll-5">Horário Reservado</td>
															</tr>
															<?php  } 
																	else if ($status_pagamento == 1)
																	{ ?>
															<tr>
																<td class="coll-1"><img src="images/livre.png" width="16" height="15"></td>
																<td class="coll-1"><?php echo $hora1 ?></td>
																<td class="coll-6">Horário livre</td>
															</tr>
													<?php 
														} 
													}
									  		 }	
										}
								}
								?>
                            </table>
Community Page
Last updated: