私の場合、クエリ true から 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;
}
}}