Welcome Guest, Not a member yet? Register   Sign In
New to PHP, need a little guidance
#1

[eluser]Chris Davies[/eluser]
Hi all. I have been using Expression Engine for a year now. I have some basic PHP knowledge, but have never really used it as such.

I have a little bit of spare time, and have started looking into learning some to make a module for EE. I have managed to get quite far but have got myself a little confused and was hoping I could find some help here as I know EE is build on codeigniter.

Basically, I have a function that I want to query the database and find all 'follow_id' that match the user id that is entered in the tagdata.

The issue I have is I am only outputting one row, and I dont really understand how to output multiple rows...

Code:
public function summary() {
    
     $tagdata = $this->EE->TMPL->tagdata;
    
     $user_id = $this->EE->TMPL->fetch_param('user_id');
     if( $user_id === FALSE ) {
         return "";
     }
    
     $this->EE->db->select( "follow_id, COUNT(*) as total" );
     $this->EE->db->where( "member_id", $user_id );
     $this->EE->db->group_by( "follow_id" );
     $query = $this->EE->db->get( "follow" );

     if( $query->num_rows() == 0 ) {
         $data = array(
             "follow_id" => 0
         );
     } else {
         $data = $query->row_array();            
     }

     $variables = array();
     $variables[] = $data;

     return $this->EE->TMPL->parse_variables( $tagdata, $variables );
}

Any advice would be wonderful, and thanks in advance for your patience with me Smile


Messages In This Thread
New to PHP, need a little guidance - by El Forum - 10-12-2012, 02:33 AM
New to PHP, need a little guidance - by El Forum - 10-12-2012, 02:56 AM
New to PHP, need a little guidance - by El Forum - 10-12-2012, 04:07 AM
New to PHP, need a little guidance - by El Forum - 10-12-2012, 04:17 AM
New to PHP, need a little guidance - by El Forum - 10-12-2012, 03:48 PM
New to PHP, need a little guidance - by El Forum - 10-13-2012, 12:18 AM
New to PHP, need a little guidance - by El Forum - 10-13-2012, 03:18 AM
New to PHP, need a little guidance - by El Forum - 10-15-2012, 12:10 AM
New to PHP, need a little guidance - by El Forum - 10-16-2012, 01:06 AM
New to PHP, need a little guidance - by El Forum - 10-16-2012, 05:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB