Jump to content

[SOLVED] Help with a script


hillbilly928

Recommended Posts

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

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

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.