nonshatter 26 Posting Whiz

Hi,
I have never used table locking before. Would something like this be sufficient? Basically I want to only allow exclusive write access to the bid table:

<?php
$query = "LOCK TABLES bid WRITE";
$placebid = mysql_query("INSERT INTO bid (auction_id, seller_id, bidder_id, b_timestamp, b_currentprice) VALUES ('$id', '$uid', '$ruid', NOW(), '$bidprice')");
$query = "UNLOCK TABLES";

if (!$placebid) {
	die ('Invalid Bid Query' . mysql_error());
}
?>

A) Does this syntax look correct?
B) Would this actually work? e.g. only allow exclusive write access?
C) Is there anything I am missing here?

Note:- I am using the InnoDB storage engine

Thanks,
Nonshatter

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.