Previous post solved, here goes another dilema:
My code snippet:
$workst=gethostbyaddr($_SERVER['REMOTE_ADDR']);
$getuid=mysql_query("SELECT * FROM users");
if($fetch=mysql_fetch_array($getuid)==NULL){ echo "No registered users found"; exit;} else
if(!preg_match("/\b$fetch['user']\b/i", $workst)) { echo "Not Found";} else echo "Found";
The last line doesn't work - I'm getting the following error "Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING" since I'm trying to read off an array.
The function works if I try to match a singe value but this is not what I want 😕
A little background:
I'm getting the remote user's computer name and check the local database against a username that matches the computer name. Since the database will contain several user names I want to somehow compare that array with preg_match as in my code snippet.
Any help is highly appreciated since I can't find the answer myself :o