News for hackers. Stuff that matters.
Re:PHP doesn't need 'finally' by morgo on Friday December 10, 2010 @09:10AM (#1991654)
The example is the wrong case. Unless you are using MyISAM tables (hint: 90%+ of the time you shouldn't), there's rarely a situation to LOCK TABLES as described.

Using transactions would make more sense:

  try {
    mysql_query("START TRANSACTION");
    // ... do lots of queries here
    mysql_query("COMMIT");
  } catch(Exception $e) {
    mysql_query("ROLLBACK");
  }
Re:PHP doesn't need 'finally' by dlsspy on Friday December 10, 2010 @10:11PM (#1994032)
You left out the code where you acquire the database connection and need to release it before returning as well as propagate the success or failure of the operation.