dynamic generating broken seat
<p>I am doing a fyp about bus travelling. Now the problem I encountered was, I am now using a trip table information to generate schedule every 12am. And my schedule table linked with seat table and bus table. So it make seat has <code>bus_id</code> and <code>schedule_id</code>. If I update a <code>seat_status</code> to broken. But my trip doesn't know the bus seat broken or not, except if I get the <code>seat_status</code> from previous schedule <code>seat_status</code>. So I wondering is it I having a problem with my database or my way looking at it.</p>

<p>Seat has seat_id, seat_row, seat_col, seat_status, bus_id, schedule_id. I will update seat_status to 0(available) 1(not available) 2(broken). But my trip was generated using query like </p>

<pre><code>$row=array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W",‌​"X","Y","Z"); 
for($i=0; $i&lt;(get_TotalSeat($s["bus_id"])/4); $i++)
 { 
for($x=1; $x&lt;=4; $x++) 
{ 
mysql_query("insert into seat(seat_row,seat_col,seat_status,bus_id,schedule_id)values('$row[$i]','$x','0'‌​,'$s[bus_id]','$s[s_id]')"); 
}
 } 
</code></pre>

<p>I do not know how to get which bus which seat is broken, seat_status = 2, and insert the seat_status is 2 during generating</p>
