if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$text = htmlspecialchars(trim($_POST['errortext']));
}
$sqlError = "SELECT ERRORSTRING FROM Errors";
$stmtError = $db->query($sqlError);
while ($rows = $stmtError->fetchArray(SQLITE3_ASSOC)){
foreach($rows as $row => $val) {
if($text != null){
if(str_contains($val, $text)){
echo $val . '<br>';
}
}
}
}
This is some of the code, basically I am creating a functional error log that a user can search through. The database has 14 fields, 3 are searchable. The example above is the errorstring field.
A user searches a key term, this checks if the term is in the text of the error. I want it to then echo out the entire row that search term was found in. I have only been able to get it to spit out the entire error code, and the column title.
Any help is appreciated, thanks!
I have tried so many different things, but I am new to php and fairly new to coding in general. I just cant seem to get it to do what I want it to do.