~n[EO]n~ Posted November 30, 2007 Share Posted November 30, 2007 Hi, I have this code which will loop the given directory and shows all the images in one page, problem I am facing is till image 9, file names are given as 01...09. How to work with that <?php $i = 01; for ($i=01; $i<=110; $i++) { echo "<div><img src=\"http://localhost/drawings/3d_drawing_models/images/".$i.".jpg\" /></div>"; } ?> Any help.. Thanks... Quote Link to comment Share on other sites More sharing options...
Wes1890 Posted November 30, 2007 Share Posted November 30, 2007 You can't have 01 as a variable.. do this instead <?php for ($i=1; $i<=110; $i++) { if ($i < 10) { $i = "0".$i; } else { } echo "<div><img src=\"http://localhost/drawings/3d_drawing_models/images/".$i.".jpg\" /></div>"; } ?> Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted November 30, 2007 Author Share Posted November 30, 2007 EDIT: Sorry LOL... forgot to change the path... works perfectly now Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.