Hi
I am trying to get this function to work but having issues
// check that policy number not entered on the DB if no policy is entered skip Mysql query
function validatePolicyNumber($PolicyNumber){
//Return Session Value so user does not have to retype entry
return $_SESSION['PolicyNumberAdd'] = $PolicyNumber;
$Connection = mysql_connect("localhost", "root", "")or die(mysql_error());
mysql_select_db('mobility', $Connection) or die('Could not select database.');
//if it's NOT valid
$UniqueQuery = "SELECT $PolicyNumber FROM tblpolicies WHERE PolicyNumber='{$PolicyNumber}'";
$result = mysql_query($UniqueQuery, $Connection);
if(mysql_num_rows($result) >=1 )
return false;
//if it's valid
else
return true;
}
I tried to even use a global variable but still didnt work
// check that policy number not entered on the DB if no policy is entered skip Mysql query
function validatePolicyNumber($PolicyNumber){
//Return Session Value so user does not have to retype entry
return $_SESSION['PolicyNumberAdd'] = $PolicyNumber;
global $Connection;
$Connection = mysql_connect("localhost", "root", "")or die(mysql_error());
mysql_select_db('mobility', $Connection) or die('Could not select database.');
//if it's NOT valid
$UniqueQuery = "SELECT $PolicyNumber FROM tblpolicies WHERE PolicyNumber='{$PolicyNumber}'";
$result = mysql_query($UniqueQuery, $Connection);
if(mysql_num_rows($result) >=1 )
return false;
//if it's valid
else
return true;
}
Please assist