Sorry that this did not get updated sooner, it somehow got associated with the default Technical Support Representative user by mistake.
I think the easiest way to get the quotes around the value would be to just add them in on this line:
$query_WAATKvisitors = sprintf("SELECT * FROM visitors WHERE VisitorEmail = %s", $ParamVisitorEmail_WAATKvisitors);
You can update it like this for single quotes:
$query_WAATKvisitors = sprintf("SELECT * FROM visitors WHERE VisitorEmail = '%s'", $ParamVisitorEmail_WAATKvisitors);
Or like this for double quotes:
$query_WAATKvisitors = sprintf("SELECT * FROM visitors WHERE VisitorEmail = \"%s\"", $ParamVisitorEmail_WAATKvisitors);
I think the problem is that it is expecting the userID here and not a string value like the email address.