Custom code does not work anymore

thyl123 01 Nov, 2015
Hey Guys,

this custom code doesn't work anymore.


<?php
$db =& JFactory::getDBO();
$query = "
    SELECT COUNT(*)
        FROM `xxxxx_chronoengine_chronoforms_Spargelturnier_2016`
        WHERE `selector` = '1' ;
";
$db->setQuery($query);
$count = $db->loadResult();
if ( $count > 1 ) {
  $mainframe->redirect(JURI::root().'index.php/wir-sind-voll.html'); 
}
?>


There is only a blank white page shown. No redirection to index.php/wir-sind-voll.html. The-Redirection-Page is public.

Thank you for your ideas.
GreyHead 02 Nov, 2015
Answer
1 Likes
Hi thy123,

Please see this FAQ

In Joomla! 3 you should remove the & from the second line.

Also $mainframe isn't defined in your code snippet, you might need to add
$app = JFactory::getApplication(); // add this line
$app->redirect(JURI::root().'index.php/wir-sind-voll.html'); // update this one

Bob
This topic is locked and no more replies can be posted.