Welcome Guest, Not a member yet? Register   Sign In
Very strange database result
#1

Hello!
I have a code that fetches settings from the DB but instead of returning a value it returns key name.

The code:

PHP Code:
public function getValue($key){
 
       $CI =& get_instance();
 
       $query $CI->db->query('SELECT ? FROM settings', array($key));
 
       $row=$query->result_array()[0];
 
       var_dump($row);
 
       //return $row[$key];
 
   
The output:

Code:
array(1) { ["max_problems_in_selector"]=> string(24) "max_problems_in_selector" }

The table:
   
Reply
#2

So what $key are you specifying?

Use last_query() to check that you are getting a correct SQL query. Run that one in phpmyadmin and see if that give you the correct results.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB