Reputation: 3
if(!class_exists('MySql'))
{ include('MySql.php'); }
$sql=new MySql();
$sql->connect();
$sqlCommand="insert into `freecomputermarket`.`members`
(`UserName`,`Password`,`Email`,`BirthDate`,`RegisterationDate`,`ActivationCode`,
`ActivationLink`,`IsActive`,`Gender`)
values('$this->_userName','$this->_password','$this->_email','$this->_birthDate',
'$this->_registerationDate','$this->_activationCode','$this->_activationLink',
'$this->_isActive','$this->_gender')";
$sql->query($sqlCommand);
how i can get the Auto-increment ID inserted?
Upvotes: 0
Views: 632
Reputation: 581
$sql->query($sqlCommand);
$id = lastInsertId();
Documentation here: http://php.net/manual/en/pdo.lastinsertid.php
Upvotes: 0
Reputation: 21866
You have hidden the implementation details of your MySql
class very well.
Upvotes: 2