• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Pictures and PHP

jynt

New Member
How would you put a picture into a page using PHP?

Another thing, I want to display this picture 1 time per the value of a variable. (i dont know what to write..) Say the variable is $hello, and the value is 90. Now I want to display the picture 1 time for every 30 numbers in $hello, in this case it would display 3 times because the value of $hello is 90. Am I making any sence?
 
Ok, in this web game, thats kind of like a medevil type game, you have land. You lose land by, being attacked and gain it by attacking. Also, by building buildings you take up land. I want to use pictures to show graphically what land is free, and what land is taken by each building.
Now each picture represents 30 acres of land. For every 30 acres of land I want a picture displayed. 3 pictures displayed, would be 90 acres of land. What I want to know, is how I would display a picture (I dont know how to with php). Then to display that picture an amount of times according to the value of $land.
 
PHP:
for($i=1;$i*30<=$land;$i++){
echo "<img src=\"land.gif\">";
}
echo "<br>";

Something like that.
 
Last edited:
Thanks alot. So I can just use echo to display images? I don't understand the other stuff but ill catch on soon enough. thanks again.
 
Well, it's not displaying the image, it's outputing HTML that displays the image.

And before you go any further, I suggest you find yourself a tutorial to read.
 
Now I have


if($user[freeland] > 30) {
print "<img src=\"land.gif\">";
}


But it doesn't display the picture, or any errors.
The value of $user[freeland] is more than 30. What have I done wrong here?
 
Back
Top