A simple problem!

From: Date: Tue, 24 Apr 2001 17:54:26 +0000
Subject: A simple problem!
Groups: php.general 
Request: Send a blank email to php-general+get-50137@lists.php.net to get a copy of this message
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.

« previous php.general (#50137) next »