所以,我试图建立一个基本的预订系统,但我不能做出适当的检查。应该是这样,检查某个日期是否有任何可用的地点(从表格中选择),如果有可用的地点,请检查时间是否可用。但时间检查不起作用,并允许插入多次。我用日期检查
if(mysqli_num_rows($checkdate) > 23)
并试图用时间检查时间
if(mysqli_num_rows($checktime) > 3)
$row = mysqli_fetch_assoc($checktime);
if($row['laikas'] == $time)
和
$row2 = mysqli_fetch_assoc($timecount);
if($row2 == 4)
这是整个片段
$checkdate = mysqli_query($conn, "SELECT data FROM stalai WHERE data = '$data'");
$checktime = mysqli_query($conn, "SELECT laikas FROM stalai WHERE laikas = '$time'");
$timecount = mysqli_query($conn, "SELECT COUNT(*) FROM stalai WHERE laikas = '$time'");
$row2 = mysqli_fetch_assoc($timecount);
echo "$row2[0]<br>";
$row = mysqli_fetch_assoc($checktime);
if(mysqli_num_rows($checkdate) > 23)
{
echo "date exists<br>";
} else {
echo "date empty<br>";
//if(mysqli_num_rows($checktime) > 3)
//if($row['laikas'] == $time)
if($row2 == 4)
{
echo "time exists<br>";
}
else {
echo "time empty<br>";
所有这些可能都没有意义,写作需要一段时间。