I'm trying to insert data into an Oracle database.
The problem is in the ID of the table. In mysql it is done with auto_increment but from oracle with sequences. This is my insert code:
$stid = oci_parse($conn, 'INSERT INTO usuarios (iduser, nombre, apellido,correo,passwd,codigo,activacion) VALUES(:iduser, :nombre, :apellido, :email, :passwd, :codigo, :activacion)');
$activacion = 1;
$id = $stid->lastInsertId();
oci_bind_by_name($stid, ':iduser', $id);
oci_bind_by_name($stid, ':nombre', $user);
oci_bind_by_name($stid, ':apellido', $apellido);
oci_bind_by_name($stid, ':email', $email);
oci_bind_by_name($stid, ':passwd', $pass);
oci_bind_by_name($stid, ':codigo', $aleatorio);
oci_bind_by_name($stid, ':activacion', $activacion);
$r = oci_execute($stid);
oci_free_statement($stid);
oci_close($conn);
The problem is here:
$id = $stid->lastInsertId();
Fatal error: Uncaught Error: Call to a member function lastInsertId () on resource in
How can I get the last id from the table, add one and insert the value? Thank you very much.