Hello all,
i have started my first projekt with Chronoforms ... and as expected i have my first problem π
I created a Form to save data to a database. That was easy. ( With this forrum ...π ). Next step would be a check before saving if this data already exists in the database. I have two field with prename and surename. I want to check if there is already a combination of this in the database or not.
I found the EVENET SWITCHER. For first test i just have two Display Message event for both cases. One Returns "Data ok" the other " Data exists"
My problem is now, that there is never any Message displayed. I fear i have a error in my code so no case is occured ...
Can anybody help me ?
Thx and Greets from Germany
... my code for the event switcher is :
i have started my first projekt with Chronoforms ... and as expected i have my first problem π
I created a Form to save data to a database. That was easy. ( With this forrum ...π ). Next step would be a check before saving if this data already exists in the database. I have two field with prename and surename. I want to check if there is already a combination of this in the database or not.
I found the EVENET SWITCHER. For first test i just have two Display Message event for both cases. One Returns "Data ok" the other " Data exists"
My problem is now, that there is never any Message displayed. I fear i have a error in my code so no case is occured ...
Can anybody help me ?
Thx and Greets from Germany
... my code for the event switcher is :
<?php
$db =JFactory::getDBO();
$query = "
SELECT `id`
FROM `#__Data_Player`
WHERE `player_vn` = '{$form->data['player_vn']}'
AND `player_nn` = '{$form->data['player_nn']}'
";
$db->setQuery($query);
$num_rows = $db->getNumRows()
if ($num_rows === 0) {
return "fail";
} else {
return "success";
}
?>