peter s
2007-01-01 09:54:06 UTC
Fatal error: Cannot redeclare sub() (previously declared..
Because it was declared in the first loop. But i need to put it in a loop so that each row['COLOR'] from my database is automatically limited to 12 letters.
How can i do this? To change it so it works in a while loop. Thanx. Code below:
$string = $row['COLOR'];
function sub($string)
{
$Length = strlen($string);
if($Length > 12)
$string = substr($string, 0, 12);
return($string);
}
echo sub($string);