array indexing -1 works but +1 doesnt
Posted: Wed Jul 29, 2009 2:33 am
This is driving me nuts!
I have an array of photo ids and if I echo $thisphoto[$i-1]; it spits out the correct photo id; I have other code that handles that, but when I echo $thisphoto[$i+1]; it spits out nothing at all. So I tried echo $thisphoto[0]; and no surprise, it spit our the right number, but then I tried echo $thisphoto[1]; and nothing. echo count($thisphoto); spits out 7 so I don't see what the problem is. Any help would be appreciated. Thanks.
I have an array of photo ids and if I echo $thisphoto[$i-1]; it spits out the correct photo id; I have other code that handles that, but when I echo $thisphoto[$i+1]; it spits out nothing at all. So I tried echo $thisphoto[0]; and no surprise, it spit our the right number, but then I tried echo $thisphoto[1]; and nothing. echo count($thisphoto); spits out 7 so I don't see what the problem is. Any help would be appreciated. Thanks.