Hey,
I would like to make a small registration form, that's limited in places.
For this, I want to use a small db table to keep track of it. I was able to count the open positions (see below), but I would like to lock the subscriptions once the number is reached. What the best way to this?
Custom php code to count down free places from 10 for eventA:
I would like to make a small registration form, that's limited in places.
For this, I want to use a small db table to keep track of it. I was able to count the open positions (see below), but I would like to lock the subscriptions once the number is reached. What the best way to this?
Custom php code to count down free places from 10 for eventA:
$sql = "SELECT * FROM DB_DATA WHERE EVENT = EVENTA";
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
$free = 10 - $num_rows;
echo "For the moment, " . "$free" . "places free.";
Hi brononius,
To do this, use an Event Switcher action in the form On Load event with one event 'closed'.
Add code like this
In the closed event add a Display Message and a Show Stopper action.
Bob
To do this, use an Event Switcher action in the form On Load event with one event 'closed'.
Add code like this
<?php
$db = \JFactory::getDBO();
$query = "
SELECT COUNT(*)
FROM `#__DB_DATA`
WHERE `EVENT` = 'EVENTA' ;
";
$db->setQuery($query);
$count = $db->loadResult();
if ( $count > 10 ) {
return 'closed';
}
?>
In the closed event add a Display Message and a Show Stopper action.
Bob
This topic is locked and no more replies can be posted.
