How do I lock read/write to MySQL tables so that I can select and then insert without other programs reading/writing to the database?
You can lock tables using the MySQL LOCK TABLES command like this: LOCK TABLES tablename WRITE; # Do other queries here UNLOCK TABLES; See: http://dev.mysql.com/doc/refman/5.5/en/lock-tables.html