SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    E-business guru Eirik's Avatar
    Join Date
    Nov 2000
    Location
    Oslo, Norway
    Posts
    413
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    One of the scripts I'm writing saves an article into a database based on the information inputted by the user. The ID of the article is set up AUTO_INCREMENT.

    However, the next task of the script is to add chapters to this specific article, and for that, I need the article ID. Is there any way of fetching this? I mean, since it's set by AUTO_INCREMENT, I have no idea what it is, right?

    Thanks in advance !
    Sincerely,

    Eirik Johansen
    Netmaking AS

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So this is after you put it in the db you can use

    $db = mysql_connect("", "", "");
    msyql_select_db("");

    $result = mysql_query("INSERT...");

    $nextid = mysql_insert_id($db);
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

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