WalkedAirplane
Limp Gawd
- Joined
- Apr 19, 2005
- Messages
- 378
Can anyone help me out with why the below isnt working? It returns the value I want, but when placed inbetween two strings to actually display the image, it ignores the variable totally.
The echo $id; line works fine - the number shows up.
if I run
echo getMostRecent(1) I get the correct value printed on screen.
However, if I us it here:
I just get <img src=./images/000.jpg> even though $picID should be 2.
Any ideas?
Code:
function getMostRecent($id){
if(file_exists("./images/000".$id.".jpg")){
$id++;
getMostRecent($id);
}
else{
$id--;
echo $id;
return $id;
}
}
The echo $id; line works fine - the number shows up.
if I run
echo getMostRecent(1) I get the correct value printed on screen.
However, if I us it here:
Code:
displayImg(getMostRecent(1));
function displayImg($picID){
echo "<img src=\"./images/000".$picID.".jpg\">";
}
I just get <img src=./images/000.jpg> even though $picID should be 2.
Any ideas?