I have created a search function and was able to display the rows.
But I have no idea what to do about this thing:
For example, I searched name starting with J
, and lists all the names starting with J with login time and has not been logout. Meaning, the timeOut has been set to null from the first place. It displays like:
1 | Johny | 7:58 | (timeOut)
4 | Jess | 8:05 | (timeOut)`
The (timeOut) is a input type="button"
. And I what I want is whenever I click the logout, for example, I click timeOut for Johny, it will insert values now()
for the timeout, not affecting the row for Jess.
I have this code:
<?php
$result=mysqli_query($con,"SELECT * FROM records WHERE PlateNumber LIKE '%$name%'");
while($row = mysqli_fetch_array($result)) {
if($row['TimeOut'] == null){
echo "<table border='1'>" . "<tr>" ."<td style='width:100px;'>" . $row['Number']. "</td>". "<td style='width:100px;'>" . $row['PlateNumber']. "</td>". "<td style='width:100px;'>" . $row['TimeIn'] . "</td>" ."<td style='width:100px;'>" . "<form>" . "<input type='submit' name='logout' value='Log Out'/>" . "</form>". "</td>" . "</table>" ;
if(isset($_POST['logout'])){
//HELP ME IN THIS PART
}
}
}
?>
I'm not really good at php so please bear me with this. Thanks for your help.