Return the correct insert_id when adding a new album
This commit is contained in:
parent
2fed632b5c
commit
9117402035
@ -33,15 +33,16 @@ final class Album {
|
|||||||
$visible = 1;
|
$visible = 1;
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
$sysstamp = time();
|
$sysstamp = time();
|
||||||
$query = Database::prepare(Database::get(), "INSERT INTO ? (title, sysstamp, public, visible) VALUES ('?', '?', '?', '?')", array(LYCHEE_TABLE_ALBUMS, $title, $sysstamp, $public, $visible));
|
$query = Database::prepare(Database::get(), "INSERT INTO ? (title, sysstamp, public, visible) VALUES ('?', '?', '?', '?')", array(LYCHEE_TABLE_ALBUMS, $title, $sysstamp, $public, $visible));
|
||||||
$result = Database::execute(Database::get(), $query, __METHOD__, __LINE__);
|
$result = Database::execute(Database::get(), $query, __METHOD__, __LINE__);
|
||||||
|
$insertID = Database::get()->insert_id;
|
||||||
|
|
||||||
// Call plugins
|
// Call plugins
|
||||||
Plugins::get()->activate(__METHOD__, 1, func_get_args());
|
Plugins::get()->activate(__METHOD__, 1, func_get_args());
|
||||||
|
|
||||||
if ($result===false) return false;
|
if ($result===false) return false;
|
||||||
return Database::get()->insert_id;
|
return $insertID;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user