Just wondering if anyone can help me out.
I'm writing a small application at the moment which works on a credit system.
When someone adds an entry to the database I want to remove a credit. My problem is that there are a number of people assigned to one account therefore realistically I need to think about locking the record whilst it is updated.
Now I've had a quick look at the MySQL handbook which suggested using FOR UPDATE to lock the record.
When I've tried to run this however I'm getting mySQL errors thrown out.
Code I'm using is:
$sql = "SELECT quantity FROM account WHERE companyid = ".$company." FOR UPDATE ";
$sql .= "UPDATE account SET quantity = quantity - 1";