Welcome Guest, Not a member yet? Register   Sign In
Displaying Array Data
#3

[eluser]NateL[/eluser]
That works - but I feel like "$result[0]" is not very descriptive and could lead to confusion later on down the road.

I will go back and see if there's a way I can clean it up a bit, or if anyone has any other suggestions?

My model looks like this:

Code:
function editAnimal()
    {
        $this->db->from('available');
        $this->db->where('id', $this->uri->segment(3));
        $this->db->limit(1);
        $query = $this->db->get();
        return $query->result();
    }

So, when someone clicks "Edit", it brings up all the fields for this animal that they're editing....a foreach loop is not necessary for 1 item, right?

I think this is a bit easier to read

Code:
Description: <?=$row->description?>


Messages In This Thread
Displaying Array Data - by El Forum - 01-28-2009, 03:42 PM
Displaying Array Data - by El Forum - 01-28-2009, 03:55 PM
Displaying Array Data - by El Forum - 01-28-2009, 04:07 PM
Displaying Array Data - by El Forum - 01-28-2009, 04:13 PM
Displaying Array Data - by El Forum - 01-28-2009, 04:23 PM
Displaying Array Data - by El Forum - 01-28-2009, 04:33 PM
Displaying Array Data - by El Forum - 01-28-2009, 04:46 PM
Displaying Array Data - by El Forum - 01-28-2009, 04:53 PM
Displaying Array Data - by El Forum - 01-28-2009, 04:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB