pernest Posted October 6, 2009 Share Posted October 6, 2009 Hi BACKGROUND: I have multiple instances of the same php script running in a WAMP environment. The script contains mysql queries to lock certain tables in the database. I'm getting some very odd behaviour which would seem to suggest that the locks are not working, and that one instance of the script is reading from a table that another instance of the script should have a write lock on. ACTUAL QUESTION: Do two instances of the same php script running through WAMP get totally independent locks on tables in a database? I didn't post this question in the mysql forum because although it is about locking tables, it is about locking tables from the point of view of a php script. Please move it if I have posted in the wrong forum. Cheers Paul Link to comment https://forums.phpfreaks.com/topic/176697-solved-locking-mysql-tables-with-php/ Share on other sites More sharing options...
waynew Posted October 6, 2009 Share Posted October 6, 2009 Are you using transactions? Link to comment https://forums.phpfreaks.com/topic/176697-solved-locking-mysql-tables-with-php/#findComment-931583 Share on other sites More sharing options...
pernest Posted October 6, 2009 Author Share Posted October 6, 2009 Are you using transactions? I don't know. The tables are myISAM, my queries are pretty basic, and the database and tables are set up with the defaults in phpmyadmin. I will google and learn about transactions. thanks Link to comment https://forums.phpfreaks.com/topic/176697-solved-locking-mysql-tables-with-php/#findComment-931612 Share on other sites More sharing options...
pernest Posted October 6, 2009 Author Share Posted October 6, 2009 With a bit of testing I seem to have answered my own question. A table which is currently locked in one instance of a script is not accessible in a second instance of the same script running simultaneously. Paul Link to comment https://forums.phpfreaks.com/topic/176697-solved-locking-mysql-tables-with-php/#findComment-931626 Share on other sites More sharing options...
Mchl Posted October 6, 2009 Share Posted October 6, 2009 Unless you need full text search, you should switch to InnoDB tables. They have foreign key restraints, transactions and are less prone to corruptions while being as fast as MyISAM most of the time. Link to comment https://forums.phpfreaks.com/topic/176697-solved-locking-mysql-tables-with-php/#findComment-931629 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.