2011-11-10 2 views
0

MySQL 데이터베이스에 값 배열을 저장하려고합니다. -
이 어떻게 종료> ''mysql 배열을 저장 PHP

$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); 
} 

숫자는 할 수 없습니다 : 여기 내 코드는?

감사

+0

당신은 "숫자가 할 수없는"이란 무엇을 의미합니까? –

답변

4

변화

VALUES('".implode("','", $values).")'") 

VALUES('".implode("','", $values)."')") 

로는 ")'" "')"

0
그것에게 많은 시간을주지 못했지만, 내가 삽입을 생각

변경 검색어가 여기에 잘못되었습니다 :

`$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());` 

VALUES()를 닫기위한 '(작은 따옴표)가 잘못된 위치에 있습니다.

안부, 찰리

관련 문제