Hello,

I seem to be having some difficulty understanding why the following function skips 
every 5th array item, 
basically the following function takes two parameters category and an array, when 
placed inside a table it will generate
links based on the array items splitting the table into columns when more than 4 links 
have been generated. 
However as mentioned every 5th array item is skipped hmm..

The solution is probably really obvious but I can't seem to see it!

function array2links($cat, $arr) {
        $i = 0;
        $cat = rawurlencode($cat);
        while ( list( $key, $val ) = each($arr)) {

                $link = "<a class=\"cats\" href=\"products.php?Cat=$cat&Code=$key\" 
title=\"$val\">$val</a><br>";
                if ( $i < 4 ) {
                $out .= "$link";
                } else {
                $out .= "</td><td valign=\"top\">";
                $i = 0;
                continue;
                }
                $i++;
        }
        return $out;
}

Any help/ideas would be appreciated,

Regards,

Joseph.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to