Hi All,

I just can't for the life of me get the variable to output a value from
the array:
(all preceding script in place to make this work..)

The "start" date retrieved from the database is, for example, 20050412
(yyyymmdd).

The example output for each variable (w/o quotes) is:
$monthInt outputs "04"
$monthVal outputs ""

### CODE FOR DEBUGGING PURPOSES ###
while ($row = mysql_fetch_array($result)){
        $monthName = array ("", "Jan", "Feb", "Mar", "Apr", "May",
"Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
        $monthInt = substr($row['start'], 4, 2);
        echo "\$monthInt = $monthInt<br>";
        $monthVal = $monthName[$monthInt];
        echo "\$monthVal = $monthVal<br>";
        echo "<p><b>".$monthVal." ".substr($row['start'], 6,
2)."</b><br>\n".$row['details']."\n</p>\n\n";
}


### ORIGINAL CODE ###
while ($row = mysql_fetch_array($result)){
        $monthName = array ("", "Jan", "Feb", "Mar", "Apr", "May",
"Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
        echo "<p><b>".$monthName[substr($row['start'], 4, 2)]."
".substr($row['start'], 6, 2)."</b><br>\n".$row['details']."\n</p>\n\n";
}


Cheers,
Gavin

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to