在PHP中是否有可能要求在PK列中插入一个值,该值与上次保存的值相比增加了?
Myphp
public function insertNewClient($idDeposant)
{
$data = array(
'RAI_SOC' => 'A compléter de toute urgence',
'CODE_CLIENT' => 'XXXXX',
'STATUT_CLI' => '2',
'COND_REGL' => '2',
'CODE_COCLICO' => $idDeposant
);
foreach($data as $key => $value)
{
if($value === null)
unset($data[$key]);
}
$this->getDbTable()->insert($data);
}
我如何执行此功能:
$idDeposant = (int)$data->IdentificationDepot['IDDeposant'];
$client = new Application_Model_Client();
$clientMapper = new Application_Model_ClientMapper();
$clientMapper->getClientByCodeCoclico($idDeposant, $client);
$idClient = $client->getClientID();
// Jira 407
// Si le client n'existe pas, on crée un nouveau client
if ($idClient == NULL)
{
$idDeposant = (int)$data->IdentificationDepot['IDDeposant'];
$client = new Application_Model_Client();
$clientMapper = new Application_Model_ClientMapper();
$clientMapper->insertNewClient($idDeposant);
$idClient = $client->getClientID();
}
当我使用insertNewClient函数在表中插入新客户端时,我想自动分配一个client_id,然后将其取回我的php代码中以操纵该值。