收到错误:
错误号:1366
不正确的字符串值:第 1 行的列 'last_name' 的 '\xCC_a'
更新
phppos_people
集first_name
= 'Juan Gordon',last_name
= 'Garc�_a',phone_number
= '',address_1
= '',address_2
= '',city
= '',state
= '',zip
= '',country
= ' ',comments
= '' 哪里person_id
= '238'文件名:/Library/WebServer/Documents/PHP-Point-Of-Sale/models/person.php
行号:85
代码:
//Skip first row
fgetcsv($handle);
while (($data = fgetcsv($handle)) !== FALSE)
{
$person_data = array(
'first_name'=>$data[0],
'last_name'=>$data[1],
'email'=>$data[2],
'phone_number'=>$data[3],
'address_1'=>$data[4],
'address_2'=>$data[5],
'city'=>$data[6],
'state'=>$data[7],
'zip'=>$data[8],
'country'=>$data[9],
'comments'=>$data[10]
);
$customer_data=array(
'account_number'=>$data[11]=='' ? null:$data[11],
'taxable'=>$data[12]=='' ? 0:1,
'company_name' => $data[13],
);
if($this->Customer->exists($data[14]))
{
$this->Customer->save($person_data,$customer_data,$data[14]);
}
else if(!$this->Customer->save($person_data,$customer_data))
{
echo json_encode( array('success'=>false,'message'=>lang('customers_duplicate_account_id')));
return;
}
}
数据库列使用 utf8_unicode_ci 编码
我尝试使用 utf8_encode,但没有奏效