i have a little preg_match problem i need some assistance with if you can ?
i am trying to match the error from a sql query to a form field value so i can highlight the field for the user
code is a s follows:
Code: Select all
// $error is of form
// ERROR 1062:
// Duplicate entry 'asdfasd' for key 2
if(strlen($error) > 0){
$errString = split(':', $error);
$errString = split('''', $errString[1]);
print_r($errString[1] . '<br>');
// output here is: asdfasd
if(preg_match("/\b$val\b/i", $errString[1])){
$style = 'style="color:#FF0000; background-color: #CCCCCC;"';
}
else{
$style = '';
}
}Code: Select all
Company Name: 6 - A New Company
Product Name: asdfasd
Title: qref adsf345qe qewrf 435tw7dsaasdaser23f
Key Number: ju8577356 365asr43q a35676848sdfwqer
Date: 24-06-2004
Time Code: 3 56756 3w47846 3w3234rqwe4q34 qerw
Tape Name: 3 - Hawaii Five O
Comments:kind regards,
g00fy