I have a mysql db with a longblob field. This field contains a logfile. I know how to display this logfile with nl2br.
But what I want is to search for a string (example: failed). I want to display only the lines with the string field in it.
number of possible approaches here
1. insert each line into an array, iterate the array and use strpos to search for the string in question.
2. similar but use preg_grep()
//assume file is in $row['logFile']
$logEntries = explode("\n", $row['logFile']);
although i have assumed you are asking how to do this in php (as this is a php forum), you can always use regex in a query to get the answers directly. a pattern like this should work
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.