在我的我试图从查询中检索 last_insert (ID) 真正调用一个函数这里是我调用我的函数的地方:
$lead = $_leadh->addLead($lead_data, $call_data['number'], $user);
$LeadID = $lead['id'];
我没有得到任何结果?这是我的 addLead 函数:
function addLead(array $lead_data, $number, $user) {
//check if lead with same number and name exist in db
if ($checker = >= 1)
{
//return lead id as existed
$data = $query->fetch_array(MYSQLI_ASSOC);
return array('id'=>$data['lead_id'], 'exists'=>true);
}
else
{
//insert new lead into db
if ($query = $this->QueryDB("INSERT", "INTO leads (lead_name)
VALUES ('".$this->EscapeString($lead_data['lead_name'])))
{
//return lead id as new
return array('id'=>$this->insert_id, 'exists'=>false);
}
else
{
//output error if insertion fail
return false;
}
}}