我有一个 php 和 mysql 脚本,我想根据 mysql 表中的值创建不同的结果。
我将 horas 数组中的 te 值与行的 hora 变量的值进行比较。如果它同样我做其他事情,它会做其他事情。但是我的疑问是,如果条件为真,我该如何更改到下一行?
$con = db_connect();
$result = mysqli_query($con,"SELECT * FROM projetor WHERE data = '$mydate' AND hora = '$hora'");
$horas=array("a","b","c","d","e","f","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x");
$arrlength=count($horas);
while($row = mysqli_fetch_array($result)){
$cod = $row['cod'];
$data = $row['data'];
$hora = $row['hora'];
$professor = $row['professor'];
$sala = $row['sala'];
for($x=0;$x<$arrlength;$x++)
{
if ($horas[$x] == $hora){
echo "<tr>";
echo "<td>" .$professor . "</td>";
echo "</tr>";
next($row);//how to go to next row??
}
else{
$h=$horas[$x];
$professor ="<a href='add_reserva.php?hora=$h&mydate=$mydate'>Requisitar</a>";
echo "<tr>";
echo "</tr>";
}
}
}