title: Updating Linking Tables
body: <p>I've currently adding a bit of functionality that manages holiday lettings on top of a CMS that runs on PHP and MySQL.</p>
  
  <p>The CMS stores the property details on a couple of tables, and I'm adding a third table (<code>letting_times</code>) that will contain information about when people are staying at the property. Basic functionality would allow the user to add new times when a guest is staying, edit the times that the guest is staying and remove the booking if the guest no longer wants to stay at the property.</p>
  
  <p>Right now the best way that I can think of updating the times that the property is occupied is to delete all the times contained in the letting_times database and reinsert them again. The only other way that I can think to do this would be to include the table's primary key and do an update if that is present and has a value, otherwise do an insert, but this would not delete rows of data if they are removed.</p>
  
  <p>Is there a better way of doing this?</p>