私はここにいくつかの問題がありますクエリの1つがPHP MySQLのデータの範囲内にあるかどうかをチェックする方法?
入力のいずれかを確認する方法はデータの範囲ですか?両方のデータは、両方のデータがデータ
の範囲の間にある同じ値またはを持っている場合は、最初の文だけで実行した場合でも、データのいずれかが範囲であれば、それは実行されません。
私の質問は、入力のいずれかが範囲内にあるかどうかを確認する方法ですか?
次のようにコード:
<?php
$connect = mysqli_connect("", "root", "", "");
global $connect;
if(isset($_POST['Submit'])){
$time_out = $_POST['time_out'];
$time_enter = $_POST['time_enter'];
$sql = "SELECT * FROM table";
$get = mysqli_query($connect,$sql);
if($get && mysqli_num_rows($get) > 0){
while($row = mysqli_fetch_assoc($get)){
$time_out_db = $row['time_out'];
$time_enter_db = $row['time_enter'];
if(($time_out >= $time_out_db) && ($time_enter <= $time_enter_db))
{
echo "Time is in between";
}
else if(){
echo "Either one of the time_out or time_enter is in the range";
}
}
mysqli_free_result($get);
}else{
echo "Nothin here !";
}
}
?>
<form action="time.php" method="post">
<table>
<tr>
<td><i class="fa fa-unlock-alt"></i> </td>
<td>Time out : </td>
<td><input type ="text" name="time_out" size="30"></td>
</tr>
<tr>
<td><i class="fa fa-unlock-alt"></i> </td>
<td>Time enter : </td>
<td><input type ="text" name="time_enter" size="30"></td>
</tr>
</table>
<p><input class="btnSuccess" type ="submit" name="Submit" value="Submit"> </p>
</form>
感謝。
ORをurクエリで変更してください! – Soheyl
既に行っていますが、それ以外の入力を実行できません:) – Jamilah
ORでの過去のurクエリpls :) – Soheyl