php - var dump is showing result but data is not getiing inserted in DB -


i trying post value in db reason data not being inserted. array returned view not empty. query not executing.

part of view:

<?echo form_open_multipart('eva/evluation_questions_value_entry'); ?>  <input type="hidden" name="id" value="<?php echo htmlspecialchars($id) ?>"> <?php  foreach ($info $row){    echo "<div class='row'>";   $i=$row->id;   echo "<div class='firstc'>".$row->id ."</div>";    echo "<div class='secondc'>".$row->name ."</div>";    echo  '<input type="hidden" name="training_evaluation_entry_id'.$i.'" value='.$i.'>';             //some codes <input id="submit" type="submit" value="submit" name="submit">    </form>  

the controller:

    public function evluation_questions_value_entry() {     $this->load->helper('url');     $this->load->helper(array('form', 'url'));     $this->load->model('trainingevaluationmodel');     $trainingevaluation = $this->trainingevaluationmodel->evluation_questions_value_entry(); } 

the model:

$this->ip_address = isset($_server['http_x_forwarded_for']) ? $_server['http_x_forwarded_for'] . '||' . $_server['remote_addr'] : $_server['remote_addr'];         $this->created_on = date('y-m-d h:i:s'); $this->created_by = 101; $this->updated_on = null; $this->updated_by = 0;   ($i = 1; $i <= 13; $i++) {      $this->training_evaluation_entry_id = $_post['training_evaluation_entry_id'.$i];     $this->value = $this->db->escape($_post['group'.$i]);       $query = "insert training_evaluation_info(training_evaluation_entry_id,value,ip_address,created_by)      values($this->training_evaluation_entry_id,$this->value,'$this->ip_address',$this->created_by)";     if ($this->db->affected_rows()>0) {     return true; } return false;     

}

it not give error , data array passed model why not being inserted in db??

your quoting aside looks dangerous without escaping fields (i recommend learn parameterized queries), in case you're setting $query;

$query = "insert training_evaluation_info(training_evaluation_entry_id,value,ip_address,created_by)  values($this->training_evaluation_entry_id,$this->value,'$this->ip_address',$this->created_by)"; 

...but never executing it.

you'll want add a;

$this->db->query($query); 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

colors - Anyway to make the uBaseColor value transparent? Three.js && ShaderToon.js -