Loading ...
Sorry, an error occurred while loading the content.

Re: [phpXperts] mysql_num_rows() expects parameter 1 to be resource, boolean given in C

Expand Messages
  • Mahfuz-ur Rahman
    check mysql connection. for more details information use mysql_error funtion
    Message 1 of 2 , May 21, 2013
    • 0 Attachment
      check  mysql connection. for more details information use mysql_error funtion


      On Mon, May 13, 2013 at 7:36 PM, DIGEST <najbaan@...> wrote:
       


      It works from webserever, but not from local host
      My Code is, the below

      <?php
      include "connect.php";
      if(isset($_POST["signup"]))
      {
      $un=$_POST["uname"];
      $pw=$_POST["pwd"];
      $fn=$_POST["fname"];
      $ln=$_POST["lname"];
      $eml=$_POST["email"];
      $ph=$_POST["phone"];
      $gen=$_POST["radiobutton"];
      $ad=$_POST["add"];
      /*$phot=$_FILES["photo"]["name"];
      move_uploaded_file($_FILES["photo"]["tmp_name"],'../photo/'.$phot);*/
      $res=mysql_query("select * from users where uname='$un' or email='$eml'");
      /*or email='$eml'"*/
      $row=mysql_num_rows($res);
      if($row==0)
      {
      mysql_query("insert into users(rdate,uname,pwd,fname,lname,email,phone,gender,address,sdate)values(CURDATE(),'$un','$pw','$fn','$ln','$eml','$ph','$gen','$ad',CURDATE())");
      echo "<script language='javascript'>alert('Registration Successfull, An activation email will be send in 24 hours to your email account, Pleace check and confirm, Thanks')</script>";

      }
      else
      {
      echo "<script language='javascript'>alert('Username or email already registered before, Please use different username or email')</script>";
      }
      }
      ?>


    Your message has been successfully submitted and would be delivered to recipients shortly.