DotNetGnat
Programmer
Guys,
I wrote the following function that is either expected to return true or false:
I get the result as true but record is not gettting inserted into the tables.
What am i doing wrong.
Thanks
-DNG
I wrote the following function that is either expected to return true or false:
Code:
function addItems($id, $listid,$itemname, $itemcomments){
$uldate = date('m/d/Y');
mysql_query("LOCK TABLES ".TBL1.",".TBL2.",".TBL2." WRITE");
mysql_query("SET AUTOCOMMIT = 0");
$q = "INSERT INTO ".TBL1."(id, listid, activeind, uldate)"
."VALUES ($id, $listid, 1, '$uldate')";
mysql_query($q, $this->connection);
$itemid = mysql_query("SELECT LAST_INSERT_ID()", $this->connection);
$q = "INSERT INTO ".TBL2."(itemid, itemname)"
."VALUES ($itemid, '$itemname')"
. "; INSERT INTO ".TBL3."(itemid, id, comments, commentdate) VALUES ($itemid, $id, '$itemcomments', '$uldate')";
$result = mysql_query("COMMIT");
mysql_query("UNLOCK TABLES");
return $result;
}
I get the result as true but record is not gettting inserted into the tables.
What am i doing wrong.
Thanks
-DNG