How does zend obtain the ID of the primary key that just inserted a piece of data? ------ Solution ------------------ $ lastid $ db-& gt; lastInsertId (); then you can get the latest id value ------ solution ------------------ reference: how do I obtain the primary key id value of the inserted data? Positive solution ...... Top .... -Zend: obtains the ID of the inserted data.
How do I obtain the primary key id value of the inserted data?
------ Solution --------------------
$ Lastid = $ db-> lastInsertId ();
In this way, you can obtain the latest id value.
------ Solution --------------------
Reference:
How do I obtain the primary key id value of the inserted data?
Positive solution ...... Top ....
------ Solution --------------------
//
// Insert into round_table
// (Noble_title, first_name, favorite_color)
// VALUES ("King", "Arthur", "blue ");
//
// Create a $ db object and then...
// Insert an array and insert data rows in the format of "column name" => "data"
$ Row = array (
'Noble _ title' => 'King ',
'First _ name' => 'Arthur ',
'Favorite _ color' => 'blue ',
);
// Insert data table
$ Table = 'round _ table ';
// I insert data rows and return the number of rows
$ Rows_affected = $ db-> insert ($ table, $ row );
$ Last_insert_id = $ db-> lastInsertId ();