Welcome Guest, Not a member yet? Register   Sign In
Why Does My Query Not Work ?
#1

[eluser]vincej[/eluser]
Hi ! I have a real simple query:

Code:
function getChild(){
        $message="No Available Data";                      /*Used in line 60*/
        $id=$this->attribute('id');
        $this->db->select('uri','id','title');
        $this->db->where('parent_id',$id);
        $Q = $this->db->get('default_pages');
        if ($Q->num_rows() > 0){
           foreach ($Q->result_array() as $row){
               $child[] = $row;}
                return var_dump($child);
        }
        else{return $message;}

    }

For some bizaar reason which I can not pin point I am only getting the first value out - the "uri", ID and Title are missing.

Code:
array
  0 =>
    array
      'uri' => string 'roofing/rubber/euroshake-heavy' (length=30)

However, if I remove URI from the select - I get ID ... the next one along. My gut feeling is that there is something wrong with the way I am formulating the result array. I have checked the CI guide - but can not see what I am doing wrong.

The data is there in the DB and the query is good - but what am I doing wrong with the array - I want all three values ?


Many Thanks !



Messages In This Thread
Why Does My Query Not Work ? - by El Forum - 06-14-2013, 02:28 PM
Why Does My Query Not Work ? - by El Forum - 06-14-2013, 04:23 PM
Why Does My Query Not Work ? - by El Forum - 06-14-2013, 04:43 PM
Why Does My Query Not Work ? - by El Forum - 06-15-2013, 02:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB