I am creating a place where people can reserve tables. This is a project for school.
But the point is that I want to check in my database if the table is already reserved for the chosen date & time and if true, add a class to it so it becomes red, or something like that.
I have this code now but i don't want to do the same thing for table 2 - 18 because of the gigantic code I'll get. There must be an easier way. Anybody any ideas?
<?
$date = $_GET['date'];
$time = $_GET['time'];
?>
<button class="table
<?
$table1 = $con->prepare( "SELECT * FROM `table` WHERE `table` = 1 AND `date` = ? AND `time` = ?" );
$table1->bindValue( 1, $date );
$table1->bindValue( 2, $time );
$table1->execute();
if( $tafel1->rowCount() > 0 ) { echo "active";}
?>"></button>