php - Zend Framework Database Insert Issue -
i'm starting out using zend framework , have created suitable model saves data database table. issue having sql statement trying insert '?' value each column in database. have created following save function passes array of data dbtable adapter functions:
public function save() { $data = $this->getdata(); if ($data['pageid']==0) { $this->getdbtable()->insert($data); } else { $this->getdbtable()->update($data, array('pageid = ?' => $data['pageid'])); } }
this seems go through appropriate motions item not added database , sql statement within mysql logs looks like:
insert db_table ('pageid','title','body') values ('?', '?', '?');
not quite sure falling down, pointers gratefully received.
thanks
data should in next format:
$data = array( 'pageid' => 1, 'title' => 'title', 'body' => 'body' );
are sure $this->getdbtable()
returns db adapter? try use:
$db = new zend_db_table('table_name'); $db->insert($data);
Comments
Post a Comment