How do I get lastInsertId() when doing an Insert?

How do I get lastInsertId() when doing an Insert?

muuuchomuuucho Posts: 7Questions: 2Answers: 0
edited November 2013 in General
I am totaly new to prepared statements. What do I replace "???" with?
[code]
$pdo = Database::connect();
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "INSERT INTO users (fN, lN, email, pass, activationCode, tC) VALUES(?, ?, ?, ?, ?, ?)";
$q = $pdo->prepare($sql);
$uId = $pdo->???->lastInsertId() ;
$q->execute(array($fN, $lN, $email, $pass, $a, $tC));
Database::disconnect();
[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    This is not a PHP forum, but rather one for DataTables. If you have a PHP question, you'd be much better asking in a PHP forum or StackOverflow or similar.

    Allan
  • muuuchomuuucho Posts: 7Questions: 2Answers: 0
    ok
This discussion has been closed.