is this code what im doing is correct..?
im using codeigniter framework of this one…engine use is iNNodb

db->simple_query('SET AUTOCOMMIT=0');
$lockquery = "LOCK TABLE costumer_prof WRITE";

$db->insert('costumer_prof',$valueAdded);
if($db->trans_status() === FALSE) //is this ok to used trans_status without trans_start or trans_begin..?
{
$db->trans_rollback()
return 1;
}
else
{
$db->trans_commit();
return 0;
}
$lockquery = "UNLOCK TABLE";
}
?>

am i implementing the right way to lock table or better to use

$lockquery = "LOCK TABLE costumer_prof IN SHARE MODE";

hope this thread is still active..i really appreciate for those who reply …i’ll acknowledge it:)

Recommended Answers

All 3 Replies

tnx JRM for the reply..:)..

even the i only use 1 table to lock..ill do an alias on it..?..am i right...?..

seems so. otherwise it gets complicated.
Please mark as soled if you got it working
thanks

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.