給出其實我正在尋找如何選擇在mysql表中的單元格值。mysql - 空列列表 - 錯誤:mysqli_num_rows()期望參數1是mysqli_result,布爾在
請幫助...
// checking the break already taken?
$verify = mysqli_query($conn, "SELECT COUNT(*) AS count FROM attend WHERE EmployeeNoA='$EmployeeNoA' AND SignInDate='$BreakDate' AND BreakOut_I==''");
$row = mysqli_num_rows($verify);
echo $row;
// If they didn't taken the break
if ($row == 0)
{
echo "<script>alert ('You Have Already 1st Break Out');</script>";
}
else
{
$SignInDate = $BreakDate;
$ver = "UPDATE attend SET BreakOut_I='$BreakTime' WHERE EmployeeNoA='$EmployeeNoA' AND SignInDate='$BreakDate'";
if (!mysqli_query($conn, $ver))
{
echo mysqli_error($conn);
}
else
{
echo "<script>alert ('You have 1st Break Out to GO!');</script>";
}
}
我需要的行數,其中的突破就相當於爲null,員工沒有和日標從輸入值給出
請找完整的PHP編碼
<?php
$conn = mysqli_connect("localhost", "Vijay", "vijay123", "test");
if (mysqli_connect_errno())
{
echo "Unable to connect the Server" . mysqli_connect_error();
}
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$EmployeeNoA=mysqli_real_escape_string($conn, $_POST['EmployeeNoA']);
$EmployeeNameA=mysqli_real_escape_string($conn, $_POST['EmployeeNameA']);
$Break=mysqli_real_escape_string($conn, $_POST['Break']);
$SignInDay=mysqli_real_escape_string($conn, $_POST['SignInDay']);
$BreakDate=mysqli_real_escape_string($conn, $_POST['BreakDate']);
$BreakTime=mysqli_real_escape_string($conn, $_POST['BreakTime']);
if ($Break != "0")
{
$ver = mysqli_query($conn, "SELECT COUNT(*) AS count FROM attend WHERE EmployeeNoA='$EmployeeNoA' && SignInDate='$BreakDate'");
$row = mysqli_fetch_assoc($ver);
if ($row['count'] == 0)
{
echo "<script>alert ('You are not SignIn Yet! \\n Please Sign In...');</script>";
}
else
{
$Breaks = $Break;
switch ($Breaks)
{
case ($Breaks == 'breakout1'):
// checking the break already taken?
$verify = mysqli_query($conn, "SELECT COUNT(*) AS count FROM attend WHERE (EmployeeNoA='$EmployeeNoA') AND (SignInDate='$BreakDate') AND (BreakOut_I=='' OR IS NULL(BreakOut_I))");
$row = mysqli_num_rows($conn, $verify);
echo "SELECT COUNT(*) AS count FROM attend WHERE (EmployeeNoA='$EmployeeNoA') AND (SignInDate='$BreakDate') AND (BreakOut_I=='' OR ISNULL(BreakOut_I))";
// If they didn't taken the break
if ($row == '0')
{
echo "<script>alert ('You Have Already 1st Break Out');</script>";
}
else
{
$SignInDate = $BreakDate;
$ver = "UPDATE attend SET BreakOut_I='$BreakTime' WHERE EmployeeNoA='$EmployeeNoA' AND SignInDate='$BreakDate'";
if (!mysqli_query($conn, $ver))
{
echo mysqli_error($conn);
}
else
{
echo "<script>alert ('You have 1st Break Out!');</script>";
echo "SELECT COUNT(*) AS count FROM attend WHERE (EmployeeNoA='$EmployeeNoA') AND (SignInDate='$BreakDate') AND (BreakOut_I=='' OR IS NULL(BreakOut_I))";
}
}
break;
case ($Breaks == 'breakin1'):
echo "<script>alert ('breakin1');</script>";
break;
case ($Breaks == 'lunchout'):
echo "<script>alert ('lunchout1');</script>";
break;
case ($Breaks == 'lunchin'):
echo "<script>alert ('lunchin1');</script>";
break;
case ($Breaks == 'breakout2'):
echo "<script>alert ('breakout2');</script>";
break;
case ($Breaks == 'breakin2'):
echo "<script>alert ('breakin2');</script>";
break;
}
}
}
else
{
echo "<script>alert ('Please Select the Break');</script>";
}
}
?>
IT沒有搜索列Breakout_I – Vijay
所以錯誤觸發爲空白或空值「警告:在給定的mysqli_num_rows()預計參數1被mysqli_result,布爾」回聲「你已經第一次爆發」。但BreakOut_I爲空... – Vijay