Deprecated: Function eregi() is deprecated, how to solve this error ?

Posted by Jitendra Vyas on Stack Overflow See other posts from Stack Overflow or by Jitendra Vyas
Published on 2011-02-27T07:18:28Z Indexed on 2011/02/27 7:24 UTC
Read the original article Hit count: 144

Filed under:
|
|

I'm using this php code. but it's giving error

Deprecated: Function eregi() is deprecated in C:\xampp\htdocs\fuel\emailcheck.php on line 7

<?
include_once("mastersecure.php");
$emailcheck=$_POST["member_name"];
function isValidEmail($email){
      $pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";

      if (eregi($pattern, $email)){
         return true;
      }
      else {
         return false;
      }   
   }
  if (!isValidEmail($_POST['member_name'])){
                echo "The email is invalid!";
            }
    else
     {
       $query="select email from fuel where email='$_POST[member_name]'";
       $res=mysql_query($query);
       $rowcount=mysql_num_rows($res);
       if($rowcount!=0)
       { echo "This mail is already exits"; }
     }      
?>

Any solution for this?

© Stack Overflow or respective owner

Related posts about php

Related posts about php5