Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php mysql\u num\u rows():提供的参数不是有效的mysql结果资源警告_Php_Mysql - Fatal编程技术网

Php mysql\u num\u rows():提供的参数不是有效的mysql结果资源警告

Php mysql\u num\u rows():提供的参数不是有效的mysql结果资源警告,php,mysql,Php,Mysql,问题如下: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a2138233/public_html/etc/e.conf/sys.proc/proc.reg/use.register.php on line 113 这是 use.register.php的第113行: $sql_email_check = mysql_query("SELECT uMail

问题如下:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a2138233/public_html/etc/e.conf/sys.proc/proc.reg/use.register.php on line 113
这是 use.register.php的第113行:

 $sql_email_check = mysql_query("SELECT uMail FROM eusers WHERE uMail='$rmail' ");
 $email_check = mysql_num_rows($sql_email_check);
下面是“$rmail”的变量集:

以下是HTML行:

 <input type="text" class="umail" id="ftxti" name="rmail" placeholder='email@server.com' style="width: 530px;" >

完整代码:

<?php
$mysql_host = "";
$mysql_database = "";
$mysql_user = "";
$mysql_password = "";

$link = mysql_connect($mysql_host, $mysql_user, $mysql_password, $mysql_database);
mysql_select_db("tmpu");

?>

<?php
if(isset($_POST['register'])){

     //set form variables

     $rmail       = mysql_real_escape_string(strip_tags($_POST['rmail']));

     $fname       = mysql_real_escape_string(strip_tags($_POST['fname']));
     $lname       = mysql_real_escape_string(strip_tags($_POST['lname']));

     $rname       = mysql_real_escape_string(strip_tags($_POST['rname']));

     $rpass       = mysql_real_escape_string(strip_tags($_POST['rpass']));
     $vpass       = mysql_real_escape_string(strip_tags($_POST['vpass']));


     if(isset($_POST['gender'])){
      $rgen = mysql_real_escape_string(strip_tags($_POST['gender']));
      }  

     if(isset($_POST['dobm'])){
      $dobm = mysql_real_escape_string(strip_tags($_POST['dobm']));
      } 

     if(isset($_POST['$dobd'])){
      $dobd = mysql_real_escape_string(strip_tags($_POST['dobd']));
      } 

     if(isset($_POST['doby'])){
      $doby = mysql_real_escape_string(strip_tags($_POST['doby']));
      } 

     if(isset($_POST['TOS'])){
      $TOS = mysql_real_escape_string(strip_tags($_POST['TOS']));
      } 

     $dab         = $doby.$dobm.$dobd;


     //check empty feilds

      $error = FALSE;

if(empty($rmail)){
            $error = TRUE;
             $eh = "<div class=em> Please enter an <b>Email Adress</b> to reach you from.
             This email will be used to Verify your acctount and activate it. </div>";
         }

         if(!empty($rmail)){
         if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $rmail)){
            $error = TRUE;
             $eh1 = "<div class=em> This is not a valid email... </div>";
         }}

         if(empty($fname) && empty($lname)){
            $error = TRUE;
             $eh2 = "<div class=em> Please enter your <b> First </b> and <b> Last </b> name. </div>";
         }

         if(!empty($fname)){
           if(empty($lname)){
            $error = TRUE;
             $eh3 = "<div class=em> Please enter a <b> Last </b> name. </div>";
          }
         }

         if(!empty($lname)){
           if(empty($fname)){
            $error = TRUE;
             $eh4 = "<div class=em> Please enter a <b> First </b> name. </div>";
          }
         }

         if(empty($rname)){
            $error = TRUE;
             $eh5 = "<div class=em> Please enter a <b>Username</b>. This will be used as your ewotty display name, You can Change it at anytime. </div>";
         }

         if(empty($rpass)){
            $error = TRUE;
             $eh6 = "<div class=em> Please enter a <b>Password</b>. This will be used to login to your account, Do not give it to anyone!</div>";
         }

         if($vpass != $rpass){
            $error = TRUE;
             $eh7 = "<div class=em> Your Password Verifications Did nont match, Please try again. This is to help you make sure you entered the right
             password.</div>";
         }

         if(empty($dobm) && empty($dobd) && empty($doby)){
            $error = TRUE;
             $eh8 = "<div class=em> Please Your valid <b>Birthday</b>. </div>";
         }

         if(strlen($rname) >15){
            $error = TRUE;
             $eh9 = "<div class=em> Your username is too long. (Max 15 char)</div>";
         }

         $sql_email_check = mysql_query("SELECT uMail FROM eusers WHERE uMail='$rmail' ");
         $email_check = mysql_num_rows($sql_email_check);

          var_dump($sql_email_check);
          var_dump($rmail);

         if ($email_check > 0){
            $error = TRUE;
             $eh10 = "<div class=em> The <b>email: $rmail </b> is already in use, Please register another.</div>";
         }

         $sql_tmpemail_check = mysql_query("SELECT uMail FROM tmpu WHERE uMail='$rmail'");
         $tmpemail_check = mysql_num_rows($sql_tmpemail_check);

         if ($tmpemail_check > 0){
            $error = TRUE;
             $eh11 = "<div class=em> The <b>email: $rmail </b> is already being registered.</div>";
         }


         $sql_user_check = mysql_query("SELECT uName FROM eusers WHERE uName='$rname'");
         $user_check = mysql_num_rows($sql_user_check);

         if ($user_check > 0){
            $error = TRUE;
             $eh12 = "<div class=em> The <b>username: $rname</b> is already in use by another user. Try another.</div>";
         }

         $sql_tmpuser_check = mysql_query("SELECT uName FROM tmpu WHERE uName='$rname'");
         $tmpuser_check = mysql_num_rows($sql_tmpuser_check);

         if ($tmpuser_check > 0){
            $error = TRUE;
             $eh13 = "<div class=em> The <b>username: $rname</b> is already being registered.</div>";
         }

         if(empty($tos)){
            $error = TRUE;
             $ehTOS = "<div class=em> You did not agree to our <a href=#>TOS</a> </div>";
         }

        /* display Error message if problem exists */
         if($error == TRUE)
             {
             echo "<style type='text/css'>#ers{display: block;}</style>";
             }else{
             echo "<style type='text/css'>#ers{display: none;}</style>";
             echo "<style type='text/css'>#srs{display: block;}</style>";




           $act = md5(crypt($umail));
           $hash = mysql_real_escape_string(strip_tags(md5(crypt($rmail,$eupass))));
           $verf = mysql_real_escape_string(strip_tags(md5(crypt($eupass))));
             $eupass = strip_tags(md5(md5($rpass)));

        mysql_query("INSERT INTO tmpu ( uName, fName, lName, uMail, uPass, uDob, uAct, hash, verif) VALUES
        ( '$rname', '$fname', '$lname', '$rmail', '$eupass','$dab', '$act', '$hash','$verf' )") or die (mysql_error());

// ---------------- SEND MAIL FORM ----------------

     $webmaster = "noreply@ewotty.cu.cc";

     $to = $rmail;
     $subject = "ewotty activation";
     $header  = "From: Ewotty <$webmaster>";
     $message = "
     Hello $fname \r
      Welcome to ewotty cloud community, You are atempting to register a new account with us, But to complete your registeration you will need to
      verify your account with the verfication link provided to you bellow. Once you've click this link and no errors have accured in the procces, You
      will be shown a green check to notate a successful registeration.\r

      Instructions:
        once you see the green check mark, do not navigate from page wait till the page redirects in about 3-4 seconds to the homepage
        If the page dose not redirect, you will be provided a maual redirect at the bottom of the screen. \r

      Here's the link you will need to activate your ewotty account: \r
     http://www.ewotty.cu.cc/activation/?ui=$act&acthash=$hash&verif=$verf";

     mail($to, $subject, $message, $header);         
}};


您的输入中需要一个值atribute

 <input type="text" class="umail" id="ftxti" name="rmail" value="" placeholder='email@server.com' style="width: 530px;" > 

我看不出代码中有表单标记

 <form name="yourform" method="POST" action ="" >

  .........
  your html inputs here

 </form> 

.........
您的html输入在这里

执行
var\u转储($sql\u email\u check)并查看打印出的内容。如果打印为false,则查询中存在错误。也就是说,你真的应该研究PDO。查询失败可能是因为$rmail变量。好吧,它返回一个假布尔值。我不知道该怎么办,我对MSQL和php不太熟悉…主要是MSQL..如果你是sql新手,那么你应该使用它来了解查询中的错误,这样你就可以调试它了
$sql\u email\u check=mysql\u query(“从eusers中选择uMail,其中uMail='$rmail'))或Die(“无法执行查询”。mysql\u error())执行var_dump($rmail)以查看所包含的内容…您首先并不是在检查查询是否有效。另请参见,当您在谷歌上搜索该错误消息时,有大量的资源—请记住始终首先运行快速搜索,大多数编程问题已经“存在”并得到解决。此外,当您输入问题标题时,您会看到一个可能相关的问题的巨大列表,请确保您也检查了这些问题。谢谢该值由用户输入,否?文本输入是否需要一个值?此外,表单属性、方法和操作所需的标记也不是唯一的,除非您使用其他“实时”语言,如ajaz或java?@excoret是的,您也可以使用名称atribute,当然,您在文本输入中需要值atribute。您不需要在textarea中使用它,请不要在未阅读基础知识的情况下进行注释,先用谷歌搜索,然后发表评论
 <form name="yourform" method="POST" action ="" >

  .........
  your html inputs here

 </form>