SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql_inserted_id() in PEAR:DB

    Suppose I got this function:
    PHP Code:
        /**
        * @return void
        * @param Data Array $array
        * @desc creates static content item
        */
        
    function createItem($array) {
            global 
    $db;
            
    $db -> autoExecute('trips_ads'$arrayDB_AUTOQUERY_INSERT);
            return 
    mysql_insert_id();
        } 
    How do I change the return mysql_insert_id() to $db -> showthing?
    I couldn't find it. and I didn't understand how to use the nextId()

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Australia
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    run a query with "select last_insert_id()" and fetch the result.

    The pear:B nextId is even less multi user/page proof than the last_insert_id so you'd be better off with last_insert_id but it works.


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
  •