my own first php script needs a bit of help plz!

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
mtbiking
-


Joined: 18 Mar 2004
Posts: 66

PostPosted: Wed Nov 03, 2004 2:27 am    Post subject: my own first php script needs a bit of help plz! Reply with quote

<?php
$textfile = $_GET['show'];
$handle = fopen("$textfile.txt", "r");
while (!feof($handle)) {
$buffer = fgets($handle, 4);
if ($textfile = 0) {
echo fgets(fopen("$textfile.txt", "r"); , 4); ;
} else {
echo $buffer;
}
fclose($handle);
?>


file.php?show=something

will pickup something.txt and display it

but, file.php

will not pick-up index.txt please will someone help?

i think its something to do with my if and first echo
Back to top View user's profile Send private message
amonia
-


Joined: 10 Oct 2004
Posts: 45

PostPosted: Wed Nov 03, 2004 1:05 pm    Post subject: Reply with quote

echo fgets(fopen("$textfile.txt", "r"); , 4); ;

That can be the problem - but try to change the script.
Back to top View user's profile Send private message
eznetlinks
-


Joined: 27 Sep 2003
Posts: 144

PostPosted: Wed Nov 03, 2004 10:03 pm    Post subject: Reply with quote

Not sure what you want maybe this will work.

<?php
if(!$_GET['show']){$textfile = "index";}
else{$textfile = $_GET['show'];}
$handle = fopen("$textfile.txt", "r");
echo fgets($handle , 4);
fclose($handle);
?>
Back to top View user's profile Send private message Visit poster's website
abstract
-


Joined: 28 Aug 2004
Posts: 3
Location: Birmingham UK

PostPosted: Mon Dec 06, 2004 10:20 pm    Post subject: hmm, Reply with quote

i have found that sometimes (") marks should be changed with just the single (')... god knows why, but its true :P

hope that helps, if you already got it working, i hope it can help anyone else ;)
Back to top View user's profile Send private message Visit poster's website
mtbiking
-


Joined: 18 Mar 2004
Posts: 66

PostPosted: Wed Dec 22, 2004 1:42 am    Post subject: Reply with quote

BTW Thanks eznetlinks
_________________
Check It Out... Nochex Classifieds
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB phpBB Group