Welcome Guest, Not a member yet? Register   Sign In
mysql_result Equalvilent in CodeIgniter
#1

[eluser]helloadam[/eluser]
Howdy,

I am converting a backend application into CodeIgniter. I have came across a small issue that is driving me nuts.

I have searched the wiki/user guide and forums but found no such of a solution.


My application is doing something like so,

Code:
$get_settings = $this->db->query("SELECT `data` FROM `". $this->tablePrefix ."settings` WHERE `vkey`='t_cstatusupd'");
$settings = mysql_result($get_settings,0,'data');


But I am unsure how to handle the mysql_result part. I noticed the ->row object is similar to the mysql_result part however, it does not accept the other two parameters that the script requires.


Any tips, suggestions, etc?



Thanks,
Adam
#2

[eluser]Seppo[/eluser]
CI require two steps to do that.

Code:
$get_settings = $this->db->query("SELECT `data` FROM `". $this->tablePrefix ."settings` WHERE `vkey`='t_cstatusupd'");
$row = $get_settings->row();
$settings = $row->data;

// IF you are running PHP 5 you can
$settings = $get_settings->row()->data;
#3

[eluser]helloadam[/eluser]
Seppo,

Thank you! I knew it was something simple.


Thanks!
Adam




Theme © iAndrew 2016 - Forum software by © MyBB