your variable scope is local not the function

function name()
{
    global $variable;

}


-- 

 Chris Lee
 [EMAIL PROTECTED]


""Subodh Gupta"" <[EMAIL PROTECTED]> wrote in message 
002b01c0cce9$aa670b60$c834d6d2@subodhgu">news:002b01c0cce9$aa670b60$c834d6d2@subodhgu...
Can You figure out the mistake here...??

In the following code... In the function print_entry which I am calling in some other 
file, I want each entry to printed in a different colour.

$colour = array("808080","800000","FF00FF","0000FF","008080");
$colouroffset=0;


function print_entry($row,$preserve="")
{

    // walk through any arguments passed in after the first two
    $numargs = func_num_args();
    for ($i = 2; $i < $numargs; $i++)
    {
        $field = func_get_arg($i);

        // This will transform a label string to a valid database 
        // field name - e.g., "Last Name" becomes "last_name"
        $dbfield = str_replace(" ", "_", strtolower($field));

        $dbvalue = cleanup_text($row[$dbfield],$preserve);
        $name = ucwords($field);

        print <<<EOQ
        <tr>\n
        <td valign=top align=right><b><font 
color="#$colour[$colouroffset]">$name:</font></b></td>\n  // The problem is here.. the 
value of $colour[$colouroffset] is not             <td valign=top align=left><font 
color="#$colour[$colouroffset]">$dbvalue</font></td>\n               // getting 
substituted.  Can you tell me why??
        </tr>\n\n
        EOQ;
    }    

    $colouroffset++;
}

Subodh Gupta
I have learned, Joy is not in things, it is in us.
You will ultimately be known by what you give and not what you get.




--
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