Skip to content

Instantly share code, notes, and snippets.

@INDIAN2020
Created May 22, 2013 11:20
Show Gist options
  • Select an option

  • Save INDIAN2020/5626847 to your computer and use it in GitHub Desktop.

Select an option

Save INDIAN2020/5626847 to your computer and use it in GitHub Desktop.
pdo: lastinsertId
if( $sql_statement->execute() ) {
$this->db_connect->lastInsertId();
if( $sql_statement->rowCount() > 0 ) {
$this->previousid = $this->db_connect->lastInsertId('showdate');
var_dump($this->previousid);
} else {
// no record inserted, therefore error condition exists
echo "No record inserted. Cannot proceed.";
$error = TRUE;
}
} else {
// query failed to execute
echo "Query Failed";
$error = TRUE;
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment