Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple table insertion

    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

    PHP Code:

    $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
    New Coder
    Join Date
    Jan 2010
    Location
    In a dump
    Posts
    64
    Thanks
    9
    Thanked 2 Times in 2 Posts
    Is there more code? If not you havent even performed the SQL query on $sqlinsert_audit.
    The answer my friend is blowing in the wind...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •