check value in data base

nadjibo

New Member
Hello,

Sorry my english is bad.

I want to compare the value entered by the user with the value that is in the database.

If he put the correct value, I said, your file is ready, otherwise your file is being processed

I have two tables


fabrik_dossier I stock corrects values

fabrik_users_records the value entered by the user

I tried this code in PHP Validation of the elements, but I have a message failure

$pc = JRequest::getVar('fabrik_users_records___numero_entree');
if (empty($pc)){return true;}
else{
$dbc =&JFactory::getDBO();
$dbc->setQuery("SELECT numero_dossier from fabrik_dossier WHERE numero_dossier='{$pc}'");
$pcc = $dbc->loadResult();

if ($pc = $pcc){return true;}}


Thank you
 
The last if...
if ($pc = $pcc){return true;}}
should be...
if ($pc == $pcc){return true;}}

Also if you're not sure not sure that $pc is returning what is expected - to debug, just immediately dump the value to the screen and exit;

To get the value for $pc you might want to try using...
$pc = $formModel->formData['fabrik_users_records___numero_entree'];

-or I'm even pretty sure placeholders are now working in the php validation plugin - so
$pc = '{fabrik_users_records___numero_entree}';
should work also.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top