I need help I have to passed data controller to model but data is not inserting to database how can I do this . I passed post data twig view file to Ctrl and Ctrl to model(inserting is not happening), i have issue is opencart inserting logic.
below are the code:
Ctrl code:
if (($this->request->server['REQUEST_METHOD'] == 'POST')) {
$data['name'] = $_POST["name"] . "</br>";
$data['email'] = $_POST["email"] . "</br>";
$data['phone'] = $_POST["phone"] . "</br>";
$data['ref_num'] = $_POST["ref_num"] . "</br>";
$name = $_POST["name"] . "</br>";
}
$this->load->model('account/reward');
$info = $this->model_account_reward->getRewards($data);
Model Code:
class ModelAccountReward extends Model {
public function getRewards($data = array()) {
//echo "model inside";die;
$sql = $this->db->query("insert into ".DB_PREFIX."reward ('name','email','phone','ref_num') values('".$date."')");
$query = $this->db->query($sql);
return $query->rows;
}
}