hillbilly928 Posted November 22, 2007 Share Posted November 22, 2007 Hello i am very new at PHP. I know very little of the language. I am very intrested in learning it though. I have been reading a lot of tutorials and gathering as much information as i can. I have now started to work on a same script to loop image output for a friends website. <?php $thumblocal = "http://www.montagestudio.org/Site/Tutorials_files/"; $thumbfile = "Face-screen1"; $imgnumber = '5' For ($i < $imgnumber $i = $i++) { echo '<a href=' . $thumblocal . '' . $thumbfile . '$i'.jpg /> <img src=' . $thumblocal . '' . $thumbfile . '$i'.jpg width ="130" height="90" /></a> '} next;?> This is just a test and for my learning more than anything else. I keep getting an error on line 7. Could someone please help me fix this and explain what i am doing wrong with it. Link to comment https://forums.phpfreaks.com/topic/78366-solved-help-with-a-script/ Share on other sites More sharing options...
PHP_PhREEEk Posted November 22, 2007 Share Posted November 22, 2007 http://us3.php.net/manual/en/control-structures.for.php Make sure your constructs (in this case, for) are lower case. For should be for Read the manual at the link I provided. Pay attention to semi-colons ( ; ) and how they separate the criteria for the loop to iterate. PhREEEk Link to comment https://forums.phpfreaks.com/topic/78366-solved-help-with-a-script/#findComment-396523 Share on other sites More sharing options...
darkfreaks Posted November 22, 2007 Share Posted November 22, 2007 <?php echo '<a href=' '. $thumblocal . '' . $thumbfile . '.$i.''.jpg' '/>' <img src=' . $thumblocal . '' . $thumbfile . ' '$i'.jpg width =130 height=90 /></a>'; }?> Link to comment https://forums.phpfreaks.com/topic/78366-solved-help-with-a-script/#findComment-396525 Share on other sites More sharing options...
rajivgonsalves Posted November 22, 2007 Share Posted November 22, 2007 you don't have the proper syntax should be something like the following <?php $thumblocal = "http://www.montagestudio.org/Site/Tutorials_files/"; $thumbfile = "Face-screen1"; $imgnumber = '5'; for ($i=1;$i <= $imgnumber;$i++) { echo "<a href='{$thumblocal}{$thumbfile}{$i}.jpg'><img src='{$thumblocal}{$thumbfile}{$i}.jpg' width ='130' height='90' /></a>"; } ?> you will notice and see the changes made Link to comment https://forums.phpfreaks.com/topic/78366-solved-help-with-a-script/#findComment-396534 Share on other sites More sharing options...
hillbilly928 Posted November 22, 2007 Author Share Posted November 22, 2007 PHP_PhREEEk -- Thank you for the link it explained quite a bit. I must admit it was a little confusing but i think i understand it now. darkfreaks -- Umm that did nothing.... but i will double check. rajivgonsalves -- Thank you for the code it works great. I am now going throught it and seeing what and why mine was wrong. Thank you for all your help. Link to comment https://forums.phpfreaks.com/topic/78366-solved-help-with-a-script/#findComment-396579 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.