public function save($data) { $fulltext = stripslashes($data['fulltext']); $ns = new Zend_Session_Namespace('login'); if ($data['key'] == 'add') { $db = Zend_Registry::get('connectDb'); $data1 = array('title' => $data['title'], 'images' => $data['images'], 'content' => $fulltext, 'published' => $data['published'], 'order' => $data['order'], 'created' => date('Y-m-d h-i-s'), 'question_id' => $data['question'], 'score' => $data['score'], 'user_id' => $ns->id); $db->insert('answer', $data1); } else { $tbl_tags = new Manager_Model_answer(); $where = 'id =' . $data['id']; $data1 = array('title' => $data['title'], 'images' => $data['images'], 'content' => $fulltext, 'published' => $data['published'], 'order' => $data['order'], 'created' => date('Y-m-d h-i-s'), 'question_id' => $data['question'], 'score' => $data['score'], 'user_id' => $ns->id); $tbl_tags->update($data1, $where); } }