Jump to content

reading from a text file


newbie5050

Recommended Posts

hi guys, i have tried many different ways to do this and havent been getting anywhere, so any help will be much appreciated,

i am simply reading text from a .txt file using the following code

 

$search= $_POST["search"];

$file= $search . ".txt";

if(file_exists($file)){

    $handle = fopen($search . ".txt", 'r');

 

    $data = fread($handle, $file) or error("The file you requested is empty"); 

}

else{

error ("The file you requested does not exist");

}

 

and then just printing $data for the results, but the output doesnt present all of the information in the .txt, usualy just printing the first half.

thanks in advance for any help!!

Link to comment
https://forums.phpfreaks.com/topic/67515-reading-from-a-text-file/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.