Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 2400

Joomla! 5.x Coding • Re: Custom Module not working unless logged in

$
0
0
This check doesn't make sense:

Code:

if($output != null or empty($data))
$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 (!$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



Viewing all articles
Browse latest Browse all 2400

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>