View previous topic :: View next topic |
Author |
Message |
mtbiking -
Joined: 18 Mar 2004 Posts: 66
|
Posted: Wed Nov 03, 2004 2:27 am Post subject: my own first php script needs a bit of help plz! |
|
|
<?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 |
|
|
amonia -
Joined: 10 Oct 2004 Posts: 45
|
Posted: Wed Nov 03, 2004 1:05 pm Post subject: |
|
|
echo fgets(fopen("$textfile.txt", "r"); , 4); ;
That can be the problem - but try to change the script. |
|
Back to top |
|
|
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Wed Nov 03, 2004 10:03 pm Post subject: |
|
|
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 |
|
|
abstract -
Joined: 28 Aug 2004 Posts: 3 Location: Birmingham UK
|
Posted: Mon Dec 06, 2004 10:20 pm Post subject: hmm, |
|
|
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 |
|
|
mtbiking -
Joined: 18 Mar 2004 Posts: 66
|
Posted: Wed Dec 22, 2004 1:42 am Post subject: |
|
|
BTW Thanks eznetlinks _________________ Check It Out... Nochex Classifieds |
|
Back to top |
|
|
|