Jump to content

php - search for specific lines and display in table


LMarie

Recommended Posts

Need help finding specific contents in a file (test.txt) and printing only the lines that contains this information.

 

what iv got so far (iv marked where i have issues with #)

 

<?php

$fil = fopen('/home/www/test.txt', 'r');

while (!feof($fil)) {
$line = fgets($fil);

#each line in the file contains 8 fields, separated by :: example: 301::fshsfs::fsrsyshs:ofjfghdysb::5372928230)

#if the line contains 301 in the first field then

echo $line;
else
echo 'not available!';
}

fclose($fil);

?>

 

i want the result to be displayed in a table too :S

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.