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

Thread: id problem

  1. #1
    Regular Coder
    Join Date
    Dec 2007
    Posts
    269
    Thanks
    28
    Thanked 0 Times in 0 Posts

    id problem

    table_user
    -----------------
    userid | username

    table_ad
    ----------------
    adid | userid | ad

    after i insert record into table_user i will insert userid coming from table_user into table_ad .

    but how ?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    What is userid? If its an auto increment you can fetch the last insert using either SQL's LAST_INSERT_ID() or using PHP's mysql_insert_id (assuming MySQL, most others have a similar). That can then be used to insert where necessary.


  •  

    Posting Permissions

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