It is currently Fri Mar 29, 2024 7:09 am


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: php troubles
PostPosted: Sun Feb 20, 2005 1:56 am 
Noobie
Noobie

Joined: Sun Feb 20, 2005 1:51 am
Posts: 5
i am trying to run a simple php script, but for some reason i cant get it to run. it simply diplays all of the code as if it is plaintext. do i have to manually install php?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 20, 2005 2:08 am 
Noobie
Noobie

Joined: Sun Feb 20, 2005 1:34 am
Posts: 4
Location: Palermo, Italy
Does it have a .php extension?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 20, 2005 2:57 am 
Support Team Member

Joined: Thu Feb 10, 2005 12:13 pm
Posts: 76
make sure your script defines the <?php> <?> enclosing tags and verify also the correct set of permissions - 755 in your case

_________________
Best Regards,
www.100WebSpace.com Support Team


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 20, 2005 8:04 pm 
Noobie
Noobie

Joined: Sun Feb 20, 2005 1:51 am
Posts: 5
the tags and permissions dont seem to be the problem, and yes, it does have a .php extention. i could hide the code using the <!-- //--> method, but it is still not behaving as it should. it is a small script that is meant to display the first 10 fibonacci numbers.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 20, 2005 8:15 pm 
Experienced
Experienced

Joined: Sun Feb 20, 2005 3:11 pm
Posts: 92
Location: Australia
Post the complete code.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 20, 2005 10:01 pm 
Noobie
Noobie

Joined: Sun Feb 20, 2005 1:51 am
Posts: 5
here is the code.

<html>
<body>

<?php><!--$b=1;$i;for($i = 0; $i < 10; $i++){if($a===0){print("0 bunnies.<br>");}else{print("$a bunnies.<br>");}$c=$b;$b=$a;$a=$b+$c;}print("this was made with php");//-->
<?>
<!--iframe src="forelysium.html" width=200 height=100--><!--/iframe-->

</body>
</html>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2005 12:39 am 
Moderator
Moderator

Joined: Fri Feb 11, 2005 5:38 pm
Posts: 850
Location: in a tent outside..
heres the problem ,

try this ,


<?php

<!--$b=1;$i;for($i = 0; $i < 10; $i++){if($a===0){print("0 bunnies.<br>");}else{print("$a bunnies.<br>");}$c=$b;$b=$a;$a=$b+$c;}print("this was made with php");//-->
<?>
<!--iframe src="forelysium.html" width=200 height=100--><!--/iframe-->


?>

_________________


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2005 3:09 am 
Noobie
Noobie

Joined: Sun Feb 20, 2005 1:51 am
Posts: 5
i tried that method first, and this is the first server on which it hasn't worked. it just simply spits out the code as though it cant even comprehend it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2005 3:27 am 
Experienced
Experienced

Joined: Sun Feb 20, 2005 3:11 pm
Posts: 92
Location: Australia
Code:
<?

$b=1;

$i;

for($i = 0; $i < 10; $i++){
if($a == 0){
  echo '0 bunnies.<br>';
}
else{
  echo $a;
  echo 'bunnies.<br>';
}
$c = $b;
$b = $a;
$a = $b + $c;
}
echo '<br>this was made with php';

?>


Why did you decide to use the === instead of == ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2005 3:59 am 
Noobie
Noobie

Joined: Sun Feb 20, 2005 1:51 am
Posts: 5
because i wanted to be sure that they are the same type and value, not just the same value.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2005 4:33 am 
Experienced
Experienced

Joined: Sun Feb 20, 2005 3:11 pm
Posts: 92
Location: Australia
Code:
<?

$b = 1;

$i;

for($i = 0; $i < 10; $i++){
if($a == 0){
  echo '0 bunnies.<br>';
}
else{
  echo $a;
  echo ' bunnies.<br>';
}
$c = $b;
$b = $a;
$a = $b + $c;
}
echo '<br>this was made with php';

?>


This gave the following output:
Quote:
0 bunnies.
1 bunnies.
1 bunnies.
2 bunnies.
3 bunnies.
5 bunnies.
8 bunnies.
13 bunnies.
21 bunnies.
34 bunnies.

this was made with php


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ]  Moderators: fhmagic, KJ, Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
100WebSpace © 2011