Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Seating Reservation System - PHP + MYSQL

$
0
0
Hi everyone, just a question regarding both php and mysql.
I am currently trying to create a seating reservation system where seats can be selected and booked.
I have been using these as guides :
http://forum.lowyat.net/topic/2349252/all
http://dayg.wordpress.com/2008/04/17/php-101-a-simple-seat-reservation-system/

I'm looking for a way to loop through with php to insert into my sql database rowId's (A, B, C...) and columnId's(1,2,3..) to create each seat in the data base.
Below is an example of why i would like this to work. This snippet checks whether the seat has been booked or not by cross checking array values with rowId and columnId within the DB. But obviously there isn't anything to actually be checked as of now.

$sql = "SELECT * FROM seats WHERE columnId = '$seat' AND rowId = '$row'";
       $query = mysql_query($sql);
       $check = $row['status'];
 echo $sql.'<br>';
   if($check >0)
       {
           return 'disabled';
       }
       else{
           return 'available';
       }

   }


I realize i could go through one by one with INSERT INTO Seat (rowId, columnId) VALUES(A,1)....
But this would be bad programming and later when i design it so a admin can set up the seating plan (how many seats there are)it would create further problems.

I hope this makes sense, i have been trying to find a solution for ages now. Any help given will be appreciated.

Thanks.

Viewing all articles
Browse latest Browse all 51036

Trending Articles