07-09-2008, 08:11 PM
|
#8 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
Change this line:
PHP Code:
for($a=0;$a<=count($name);$a++) {
// to
for ($a = 0; $a < count($name); $a++) {
// or better yet
$count = count($name); for ($a = 0; $a < $count; $a++) {
A numeric array begins at 0, so when it has 4 records, the last record is at index 3, like so:
Code:
$array[0] = '..';
$array[1] = '..';
$array[2] = '..';
$array[3] = '..';
So, four records, but the last number is three. When you run count() on it, it tells you that there are four records. When you run the for loop without subtracting one from the result of count() you're actually running the for loop up to index [4] which doesn't exist.
-m
|
|
|
|