tmyonline Posted March 24, 2008 Share Posted March 24, 2008 Hi guys, I need to write SQL statements to apply locks to my MySQL database tables. What is the LOCK TABLES syntax that I should use? I did some google searches and I'm not quite clear on how to do this correctly. Thanks (the rest of the code is PHP). Link to comment https://forums.phpfreaks.com/topic/97643-lock-table-sql-syntax-for-mysql/ Share on other sites More sharing options...
cooldude832 Posted March 24, 2008 Share Posted March 24, 2008 lets start with y u need to lock the tables Link to comment https://forums.phpfreaks.com/topic/97643-lock-table-sql-syntax-for-mysql/#findComment-499594 Share on other sites More sharing options...
tmyonline Posted March 24, 2008 Author Share Posted March 24, 2008 I know that locking tables is not a good idea in general but it can avoid potential conflicts where the same table(s) are accidentially assessed by two different users at the same time. In this case, an error may occur. Link to comment https://forums.phpfreaks.com/topic/97643-lock-table-sql-syntax-for-mysql/#findComment-499633 Share on other sites More sharing options...
BlueSkyIS Posted March 24, 2008 Share Posted March 24, 2008 you should lock individual records, not entire tables. Link to comment https://forums.phpfreaks.com/topic/97643-lock-table-sql-syntax-for-mysql/#findComment-499657 Share on other sites More sharing options...
cooldude832 Posted March 24, 2008 Share Posted March 24, 2008 I know that locking tables is not a good idea in general but it can avoid potential conflicts where the same table(s) are accidentially assessed by two different users at the same time. In this case, an error may occur. mysql doesn't need flock like flat files did Link to comment https://forums.phpfreaks.com/topic/97643-lock-table-sql-syntax-for-mysql/#findComment-499661 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.