Tried searching the forums and found lots of examples, but it's still not working for me so I thought I would see if I could get some help:
I want to count the number of rows in the database for a form, and based on that number either display or not display the form (ie, after 50 registrations do not show the form).
I'm trying this:
There are 3 rows in the database; however, this is the result I'm getting:
Number of rows via getNumRows:
Number of rows via count($rows): 0
Any ideas about what I'm doing wrong? Thanks!
I want to count the number of rows in the database for a form, and based on that number either display or not display the form (ie, after 50 registrations do not show the form).
I'm trying this:
<?php
$db =& JFactory::getDBO();
$query = "SELECT * FROM #__chronoforms_inspiretest";
$db->setQuery($query);
$rowx = $db->loadObject();
echo $db->getErrorMsg();
$test = $db->getNumRows();
echo 'Number of rows via getNumRows: ' . $test . '<br />';
echo 'Number of rows via count($rows): ' . count($rows);
?>
There are 3 rows in the database; however, this is the result I'm getting:
Number of rows via getNumRows:
Number of rows via count($rows): 0
Any ideas about what I'm doing wrong? Thanks!