Results 1 to 2 of 2

Thread: [RESOLVED] Get record number of last created

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    259

    Resolved [RESOLVED] Get record number of last created

    i need to get the record number of the of the record i just created. i have and field called id that is an int that is auto incremental and i use the following

    Code:
    $query = "INSERT INTO WorkOrders VALUES ('id', '$siteid', '$session->username', '$unitnumber', '$callindate', '$completeddate', '$modifieddate', '$customername', '$phone', '$emailwhendone', '$assignedto', '$address', '$worktobedone', '$workcompleted')";
    mysql_query($query);
    
    mysql_close();
    at this point here i have some text that says your new record has been completed, but i would like to say in there the record number as well so i can place a link in there to edit it. i can do the link but what is the code to get the rec number?

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    259

    Re: Get record number of last created

    i figured it out after the query statement i just add the following then use the variable through out


    Code:
    $new_rec_id = mysql_insert_id();

Posting Permissions

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



Click Here to Expand Forum to Full Width