• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to get data into array from database using an extended function built in Core

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 :

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:


  $query_array = array(
   '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'),

Querry bring pulled from database :

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

Any insights would be appreciated.

Here's maybe a more concise question -- how do I see if this line of code is pulling back the the query string from the database? If there is a better way to ask questions, please let me know. I'm new to CodeIgnitor and this community.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.