$data = array(
'name' => $group_name,
'tag' => $group_tag,
'fansub' => $group_fansub,
'scanteam' => $group_scanteam,
'alias' => $group_alias,
'published' => $published,
);
$db->insert('group', $data);
$id_group = $db->lastInsertId();
I doesn't work on my site >.>
I hoped it will work
My code:
PHP:$data = array( 'name' => $group_name, 'tag' => $group_tag, 'fansub' => $group_fansub, 'scanteam' => $group_scanteam, 'alias' => $group_alias, 'published' => $published, ); $db->insert('group', $data); $id_group = $db->lastInsertId();
I followed the ZF doc too.
Any suggestion? Maybe I did some mistakes
$data = array(
'name' => $group_name,
'tag' => $group_tag,
'fansub' => $group_fansub,
'scanteam' => $group_scanteam,
'alias' => $group_alias,
'published' => $published,
);
$where = array(
'id' => $db->lastInsertId()
);
$db->insert('group', $data, $where);
I doesn't work on my site >.>
I hoped it will work
My code:
PHP:$data = array( 'name' => $group_name, 'tag' => $group_tag, 'fansub' => $group_fansub, 'scanteam' => $group_scanteam, 'alias' => $group_alias, 'published' => $published, ); $db->insert('group', $data); $id_group = $db->lastInsertId();
I followed the ZF doc too.
Any suggestion? Maybe I did some mistakes
On my live vs. development site I'm getting different values. On my live site, the value I'm getting is the last inserted id plus one. Does anyone know if a different mysql version could produce different results? I'm running 5.0.92 and 5.1.53 respectively. If not, what else could be the problem?In the context of our DB object (well, ZF's), you can run the insert and then do:
$db->lastInsertId();
I'm not familiar with the Zend framework, Nor have I done any research from this, but I would assume (call it an educated guess).
We use essential cookies to make this site work, and optional cookies to enhance your experience.