Jump to content

Multiple table update

- - - - -

  • Please log in to reply
1 reply to this topic

#1
batowiise

batowiise

    Newbie

  • Members
  • PipPip
  • 17 posts
Hi All,

I want to keep audit of transactions. I have two tables, one acting as the main table and the other acting as a copy of the main table (audit) with some of the field copied to the audit table.

The following is my code but data is not been written to the audit table.

Your help is welcome



$traveller = $_REQUEST['traveller'];

$requestdate = $_REQUEST['requestdate'];


require_once("../admin/db.php");


$sqlinsert="INSERT INTO `internationaltravel` (`traveller`,`requestdate`)

VALUES ('$traveller','$requestdate')";

				

mysql_query($sqlinsert);

				

$last_inserted_id = mysql_insert_id();

				

$sqlinsert_audit="INSERT INTO `audit` (`date`,`initiator`,`transid`)

				VALUES ('$requestdate','$traveller',$last_inserted_id)";



#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Where is the code where you execute the query in $sqlinsert_audit?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users