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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.