我正在尝试将一个值数组保存到MySQL数据库中。下面是我的代码:
$values = array('jaime','11124583363', '5554625', '312458795','1999-12-02','soldierjesus', 'calle 12', 'carismatica', 'necesito oracion', '1', '1');
$data->create_persons('new_person', $values);
public function create_persons($table, $values)
{
$query = ("INSERT INTO $table ('name', 'number_document','phone', 'cell_phone', 'birth_date', 'email',
'address', 'other_church', 'pray_request', 'districts_id', 'professions_id')
VALUES('".implode("','", $values).")'") or die(mysqli_error());
mysqli_query($this->_connection, $query);
}号码是不能--> '‘
如何戒掉这个?
谢谢
发布于 2011-11-11 03:42:14
变化
VALUES('".implode("','", $values).")'")转到
VALUES('".implode("','", $values)."')")换句话说,将")'"更改为"')"
发布于 2011-11-11 03:47:10
我没有给出太多时间,但我认为insert查询是错误的:
`$query = ("INSERT INTO $table ('name', 'number_document','phone', 'cell_phone', 'birth_date', 'email', 'address', 'other_church', 'pray_request', 'districts_id', 'professions_id') VALUES('".implode("','", $values)."')") or die(mysqli_error());`用于闭合值()的‘(单引号)放在错误的位置。
向你致敬,查莉
https://stackoverflow.com/questions/8085303
复制相似问题