Computing.Net > Forums > Web Development > What is wrong with this PHP script?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

What is wrong with this PHP script?

Reply to Message Icon

Name: Alirezan1
Date: January 22, 2005 at 03:17:37 Pacific
OS: MDK Linux 10.1 OE
CPU/Ram: AMD Athlon
Comment:

Hello, I have written a PHP code to read a file and dump everything to the screen but it does not work. CAn anyone tell me what is wrong with my code?

thank.

<?php
$FILEPATH = "./.config/.htusers.php";
$FILE = fopen($FILEPATH, "r");

while (!feof($FILE))
$PLACE .= fgets($FILE, 3000);


fclose($FILE);

?>
<?echo $PLACE; ?>

Alireza

Alireza@arnit.net



Sponsored Link
Ads by Google

Response Number 1
Name: jam14online
Date: January 22, 2005 at 03:47:36 Pacific
Reply:

This should work:

<?php

$file = "config/htusers.php";

$handle = fopen($file, "r");

while(!feof($handle)) $data .= fgets($handle, 3000);

echo($data);

?>



0

Response Number 2
Name: Alirezan1
Date: January 22, 2005 at 03:54:27 Pacific
Reply:

Hi!
Thank you for your reply. Actually, it didn't work. It just shows a blank page:

try:

http://www.arnit.net/freehosting/rf.php

Help!

Thanks

Alireza

Alireza@arnit.net


0

Response Number 3
Name: Laler
Date: January 22, 2005 at 07:11:55 Pacific
Reply:

it's there on the source, change the echo with:

echo '<pre>'.htmlspecialchars (print_r ($data, TRUE)).'</pre>';


^o^
are you in Asia? do you watch Animax Asia? Please Vote


0

Response Number 4
Name: Laler
Date: January 22, 2005 at 09:30:55 Pacific
Reply:

htmlspecialchars alone is fine... <pre> and print_r were there to recreate the newlines and spaces...

^o^
are you in Asia? do you watch Animax Asia? Please Vote


0

Response Number 5
Name: Alirezan1
Date: January 22, 2005 at 13:19:39 Pacific
Reply:

Thank you very much! It worked! Thank you again!


Alireza

Alireza@arnit.net


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

How do i set nameservers PHP quotation mark escape



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: What is wrong with this PHP script?

What's wrong with Google www.computing.net/answers/webdevel/whats-wrong-with-google/3447.html

Javascript: Cross input via link www.computing.net/answers/webdevel/javascript-cross-input-via-link/3004.html

how to write this php script www.computing.net/answers/webdevel/how-to-write-this-php-script/2690.html