Welcome Guest, Not a member yet? Register   Sign In
Single value return "Array to string conversion?"
#2

[eluser]jmadsen[/eluser]
Even though your result() object only has one row, it is still a collection of rows. You might want to look at result_array() just to make it easier to visualize with var_dump()

The result_array() will be an array of arrays, each of those sub arrays being a row(). The function won't change up the return object simply because the requested data changes to something simpler - you have to do that yourself.

However, there are a couple things that can help:

Code:
->row()/->row_array() will grab the first row - so if you know you only have one, just use that

    ->row()->username / ->row_array()['username'] - can get a value directly

Just use them with caution - easy to make logic bugs until you're comfortable


Messages In This Thread
Single value return "Array to string conversion?" - by El Forum - 03-22-2013, 03:13 AM
Single value return "Array to string conversion?" - by El Forum - 03-22-2013, 03:35 AM
Single value return "Array to string conversion?" - by El Forum - 03-22-2013, 03:45 AM
Single value return "Array to string conversion?" - by El Forum - 03-22-2013, 03:52 AM
Single value return "Array to string conversion?" - by El Forum - 03-22-2013, 04:33 AM
Single value return "Array to string conversion?" - by El Forum - 03-22-2013, 07:09 PM
Single value return "Array to string conversion?" - by El Forum - 03-23-2013, 10:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB