Welcome Guest, Not a member yet? Register   Sign In
Array parse problem
#1

[eluser]iniweb[/eluser]
I have this code:

Code:
function Index()
{
    $content = '';

    $this->db->select('id, gal_name, description');

    $this->db->orderby('id', 'asc');

    $gallery = $this->db->get('galleries');

    if($gallery->num_rows != '0')
    {
        foreach($gallery->result() as $gal)
        {
            $num = $this->db->query("SELECT * FROM ci_images WHERE gall_id = $gal->id");

            $data = array(
                'galleries_list' => $gallery->result_array(),
                'count_images'   => "$num->num_rows",
            );
        }

        $content .= $this->parser->parse('Gallerys.tpl', $data);
    }

    $data = array(
        'content'        => $content,
        'user_info'      => $this->piclib->user_info(),
        'user_enter'     => $this->piclib->user_enter_form(),
    );

    $this->parser->parse('Main.tpl', $data);
}

All work, but count_images return latest value for all galleries.

Gallerys.tpl:

Quote:{galleries_list}
<tr>
<td align="center">
<a class="link555" href="/Gallery/{id}.html"><b>{gal_name}</b></a> <font class="text33"><b>(Images: {count_images}) </b></font>
</td>
</tr>
{/galleries_list}


Messages In This Thread
Array parse problem - by El Forum - 12-03-2007, 03:11 AM
Array parse problem - by El Forum - 12-03-2007, 03:29 AM
Array parse problem - by El Forum - 12-03-2007, 03:51 AM
Array parse problem - by El Forum - 12-03-2007, 04:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB