TheFilmGod Posted September 2, 2007 Share Posted September 2, 2007 Warning: preg_match() [function.preg-match]: Unknown modifier '{' in /home/content/i/n/t/internetknight/html/register_new.php on line 72 Warning: Wrong parameter count for array_key_exists() in /home/content/i/n/t/internetknight/html/register_new.php on line 172 Code for warning 1: // Set pattern matching for user $u_regex = "[A-Za-z0-9_]{6,20}$"; // If username has between 6 and 20 word characters if ( preg_match($u_regex, $user)) {... Code for warning 2: if ( array_key_exists($error)) {.. What did I do wrong? Quote Link to comment https://forums.phpfreaks.com/topic/67689-erors-arg/ Share on other sites More sharing options...
Fadion Posted September 2, 2007 Share Posted September 2, 2007 For the second error (as for the regex i know nothing), array_key_exists() takes two parameters, the first is the key to search for and the second is the actual array. Quote Link to comment https://forums.phpfreaks.com/topic/67689-erors-arg/#findComment-340046 Share on other sites More sharing options...
GingerRobot Posted September 2, 2007 Share Posted September 2, 2007 1.) The syntax of your regular expression is for use with ereg() Try: $u_regex = "^[A-Za-z0-9_]{6,20}$"; // If username has between 6 and 20 word characters if (ereg($u_regex, $user)) {... Notice i modified your expression slightly. You'll need the ^ to make sure the match is for the entire string. With your previous expression, someone could have put any characters at the beginning of the string, so long as the last 6-20 where alphanumeric or underscores. 2.) Again, the manual is your friend: www.php.net/array_key_exists The function requires two parameters, the first being the key you are looking for, the second being the array in which you are searching. Quote Link to comment https://forums.phpfreaks.com/topic/67689-erors-arg/#findComment-340047 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.