问题描述:

This is my controller:

class Test extends CI_Controller {

public function insert1(){

$this->load->model("test1");

$newRow = ["name" => "bob",

"id" => 123 ,

];

$this->test1->insert_entry($newRow);

}

}

I have this code for my model:

class Test1 extends CI_Model {

function insert_entry($array){

$this->db->insert("TEST",$array);​

}

}

and it gives me this error :

Parse error: syntax error, unexpected '}' in C:\wamp\www\ilink-site\application\models\test1.php on line 8

网友答案:

remove comma after 123 at that line "id" => 123 ,

网友答案:

There is in array defining. $array = array('key'=> 'value');

class Test extends CI_Controller { public function insert1(){ $this->load->model("test1"); $newRow = array("name" => "bob", "id" => 123); $this->test1->insert_entry($newRow); } }

相关阅读:
Top