Back to vBulletin 3 Articles

  #1      
11 Jun 2006, 18:19
Antivirus's Avatar  
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Design: Green Hornet,Fixed
help with foreach loop please?

What i want it to do is this: for each artisttype that is returned, i want to eval the "erc_artistroster_typerow" template and within that it cycles through the "erc_artistroster_rpt" template using the while loop.

Having some difficulty though with the foreach loop below...

here's my code:
PHP Code:
// DEFINE SETTINGS FOR COLUMNS TO SHOW 
$artists_setup = array(
'columns_to_show' => 3,
'fetch_artist' => true
); 
// END Define Settings
 
 
    
$qryartists $db->query_read("
        SELECT erc_artist.*, erc_artisttype.artisttype AS artisttype, MIN(erc_artistimage.artistimageid) AS artistimageid 
        FROM erc_artist
        LEFT JOIN erc_artisttype ON erc_artist.artisttypeid = erc_artisttype.artisttypeid
        LEFT JOIN erc_artistimage ON erc_artist.artistid = erc_artistimage.artistid
        WHERE artistisactive = '1'
        GROUP BY erc_artisttype.displayorder, artisttitle
        "
);

        
$artistimage $artist['image'];
        
$artistimageid $artist['artistimageid'];
        
$artisttitle $artist['artisttitle'];
        
$artisttype $artist['artisttype'];
        
// Get CURRENT Artist List & fetch template for each item
    
foreach (array($artisttype) as $key => $artisttypes
    
{
        eval(
'$artisttypes .= "' fetch_template("erc_artistroster_typerow") . '";');
        if (
$qryartists != '')
            {
                
$choicecounter 1;
                while (
$artist mysql_fetch_array($qryartists)) 
                {
                    eval(
'$artists .= "' fetch_template("erc_artistroster_rpt") . '";');
                    
$choicecounter++;
                    if ((
$choicecounter $artists_setup['columns_to_show']) == 0
                    {
                        
$newrow 1;
                    }
                    else 
                    {
                        
$newrow 0;
                    }
                }
            }
    }


    
// fetch template 
    
eval('print_output("' fetch_template('erc_artistroster') . '");'); 



I think i need to use a foreach loop, however i'm just getting a blank page now
__________________
Please feel free to PM me about custom work, installations, and upgrades!

http://www.eclipserecords.com - http://www.streetteam.com

vblts.ru supports vBulletin®, 2022-2024