This check doesn't make sense:
$output is always null and when $data is null the result will also be null. You should check that $result is not empty here instead. Even better, add a check for $data before executing the query and return early:
Code:
if($output != null or empty($data))
Code:
if (!$data){ return 'Please enter a valid value...';}// Connect to database$db = Factory::getDbo();...$result = $db->loadResult();if ($result){ return '<h4><a> href="' . ContentHelperRoute::getArticleRoute($result) . '"></a></h4>';}return 'Sorry! No result for your search.';
Statistics: Posted by SharkyKZ — Thu Feb 08, 2024 9:43 am