Hi!
I have a validation on serverside for at field where i store Social Security number. I need this so only one record with the same number is stored.
I use:
Sorry for a but swedish here but it is only in the error message. This number is stored like yymmdd-nnnn and the validation works for the six first number but after '-' it does not check at all.
Is there a way to solve this problem or do I have to store only numbers? (I have about 5500 records that nedds to be edited in that case.
Thanks in advance.
I have a validation on serverside for at field where i store Social Security number. I need this so only one record with the same number is stored.
I use:
<?php
$result = JRequest::getInt('nnnn', '', 'post');
if ( !$result) {
return "You must enter a reference number";
}
$db =& JFactory::getDBO();
$query = "
SELECT count(*)
FROM `#__MyTable`
WHERE `nnnn` = $result;
";
$db->setQuery($query);
$in_use = $db->loadResult();
if ( $in_use) {
return "Personnumret används redan använd Ändra Elevfil istället om det är din elev. I annat fall tar du kontakt med Company på mail[at]example.com";
}
?>
Sorry for a but swedish here but it is only in the error message. This number is stored like yymmdd-nnnn and the validation works for the six first number but after '-' it does not check at all.
Is there a way to solve this problem or do I have to store only numbers? (I have about 5500 records that nedds to be edited in that case.
Thanks in advance.