Sorry if it's a simple question but I tried to get the answer with the documentation, try to read this group and search on google without any success....
I have an sqlite database with an auto incremented field :
CREATE TABLE documents (
docid INTEGER PRIMARY KEY autoincrement,
title TEXT,
path TEXT,
thumb TEXT );
I want to insert a record with title, path and thumb data, and retreive the docid once done.
$files=new DB\SQL\Mapper($f3->get('DB'),'documents');
$files->title=$file;
$files->path=$path;
$files->thumb=$thumb;
$files->insert();
$docid=$files->get('docid');
echo "docid = $docid</br>";
$files->reset();
But each time, I got a empty docid. I checked directly on database with a select and the autoincrement works well. So, I assume, it's just a problem in my code :)
I tried to update or save after the insert, tried to find with _id..... I'm running out of ideas now. How to "refresh" the content of the cursor to get the value of autoincremente field ?
Thanks for your help,
Christophe.