Welcome Guest, Not a member yet? Register   Sign In
Unable to get data into array from database using an extended function built in Core
#1

[eluser]douglasbrownca01[/eluser]
I've created this function that exists as in my core as MY_Input.php to extend the Input function. I'm wanting to pull a query string ouf of a table and then put that value into an array and perform a search - but I can't get the data into the array and when I dump the value, I just see the array but no values.

My sense is that the function isn't working correctly and it's not bringing back anything, but I'm not sure about how to debug to figure out where the breakdown is occurring.

From MY_Inputx.php :

Code:
function load_query($query_id) {
  
  $CI =& get_instance();
  
  $rows = $CI->db->get_where('ci_query', array('id' => $query_id))->result();
  if (isset($rows[0])) {
   parse_str($rows[0]->query_string, $_GET);  
  }
  
}

Controller code:

Code:
$this->input->load_query($query_id);
  

  $query_array = array(
   'fan_type_options'=>$this->input->post('fan_type_options'),
   'fan_motor_type' => $this->input->post('fan_motor_type'),
   'fan_ac_voltage' => $this->input->post('fan_ac_voltage'),
   'fan_cfm' => $this->input->post('fan_cfm'),
   'part-no' => $this->input->post('part-no'),
  );
  
  print_r($query_array);

Querry bring pulled from database :
Code:
fan_type_options=Blower&fan_motor_type=EC&fan;_ac_voltage=&fan;_cfm=∂-no=

Result bring printed when I attempt to use the function:
Code:
Array ( [fan_type_options] => [fan_motor_type] => [fan_ac_voltage] => [fan_cfm] => [part-no] => )

Any insights would be appreciated.




Messages In This Thread
Unable to get data into array from database using an extended function built in Core - by El Forum - 01-09-2013, 07:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB