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);
如何插入自动增量ID?
最佳答案
您已经很好地隐藏了 MySql
类的实现细节。
- 如果您使用PDO,您将需要查看 LastInsertId()
- 如果您使用mysqli,请查看 mysql_insert_id() ;
- 如果您使用mysql:切换到 PDO 或 mysqli
关于php - mysql插入查询自动递增值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12707024/