Welcome Guest, Not a member yet? Register   Sign In
easy way (!) to convert result of get() into a string?
#4

[eluser]dcunited08[/eluser]
[quote author="Jamie Rumbelow" date="1225404470"]Instead of running result() on your get() object, run row() and that will return the object directly.[/quote]

Code:
$i = $this->session->userdata('id');
     $this->db->select('email')->from('users')->where('id', $i);
     $me = $this->db->get();
     $row=$me->row();
     echo $row->email

if you are using PHP5:
    echo $me->row()->email;
or even:
    echo $this->db->get()->row()->email;  //never tried but should work

I would add a test to make sure that there is only one result.


Messages In This Thread
easy way (!) to convert result of get() into a string? - by El Forum - 10-30-2008, 10:36 AM
easy way (!) to convert result of get() into a string? - by El Forum - 10-30-2008, 11:01 AM
easy way (!) to convert result of get() into a string? - by El Forum - 10-30-2008, 11:07 AM
easy way (!) to convert result of get() into a string? - by El Forum - 10-30-2008, 11:55 AM
easy way (!) to convert result of get() into a string? - by El Forum - 10-31-2008, 01:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB