[eluser]simonCI[/eluser]
Hi! I'm new to CI, I've got a db problem.
My site controller:
Code:
class Site extends CI_Controller{
public function index(){
$this->home();
}
.
.
.
public function insertValues(){
$this->load->model("get_db");
$newRow = array("name" => "blahblahblah"
);
$this->get_db->insert("$newRow");
echo "Insert done";
}
}
db model:
Code:
class Get_db extends CI_Model{
function getAll(){
$guery = $this->db->query("SELECT * FROM test");
return $guery->result();
}
function insert($data){
$this->db->insert("test", $data);
}
When calling the insertValues control I get this error:
Quote:A Database Error Occurred
Error Number: 1054
Unknown column 'Array' in 'field list'
INSERT INTO `test` (`Array`) VALUES ('')
Filename: F:\wamp\www\ci_intro\system\database\DB_driver.php
Line Number: 330
However a simple insertion like below works, which indicates there is no wrong with the database.
Code:
$guery = $this->db->query("INSERT INTO test (name) VALUES ('insertion nmame')");
What do you guys say?
Thanks/Simon