本帖最后由 xiaopeng0803 于 2010-09-08 15:02:24 编辑

解决方案 »

  1.   

    你都没连接数据库。初学要多看php手册,里面有例子。
      

  2.   

    应该是
    if(mysql_num_rows($rs)>0)
      

  3.   

    mysql_fetch_array 跟 mysql_num_rows 都是相同的用法,你给的参数必须是mysql查询返回的结果
    if(mysql_num_rows($array)>0) 可改成 if(is_array($array))int mysql_num_rows ( resource result ) //接收的是mysql查询返回的结果
    array mysql_fetch_array ( resource result [, int result_type] ) //返回的是数组明显不对了
      

  4.   

    mysql_num_rows
    数据库连接
    性病医院
    杭州保洁公司
    合肥月嫂
    中老年摄影
      

  5.   

    <?php require_once("mywebmanage/conn.php");?><?
    $username=$_POST['username'];
    $email1=$_POST['email1'];
    $acctiveme=$_POST['acctiveme'];
    $password=md5($_POST['password']);
    $yanzheng=$_POST['yanzheng'];
    $question=$_POST['question'];
    $answer=$_POST['answer']; $rs=mysql_query("select * from member where username='$username'");

    if(mysql_num_rows($rs)>0)
    {
    echo "<script>alert('用户名已经存在,请重新注册');history.go(-1);</script>";
    }
    else
    {
    $sql="insert into member(username,password,sex,email1,question,key) VALUES ('$username','$password','$acctiveme','$email1','$question','$answer')";
    echo $sql;
    $_SESSION['username']=$username;
    mysql_query($sql);
    echo "<script>alert('恭喜您,注册成功!');location.href='reg.php';</script>";
    }

    ?>提交注册成功了,可是数据里没有数据
      

  6.   

    楼上两位,他都明显没有连接数据库,就能执行mysql_fetch_array?
    “supplied argument is not a valid MySQL result resource”
      

  7.   

    <?php  require_once("mywebmanage/conn.php");?>这个是连接数据的。
      

  8.   

    resource mysql_query ( string query [, resource link_identifier] )mysql_query() 向与指定的连接标识符关联的服务器中的当前活动数据库发送一条查询。如果没有指定 link_identifier,则使用上一个打开的连接。如果没有打开的连接,本函数会尝试无参数调用 mysql_connect() 函数来建立一个连接并使用之。查询结果会被缓存。
      

  9.   

    int mysql_num_rows ( resource result )
    mysql_num_rows() 返回结果集中行的数目。此命令仅对 SELECT 语句有效。要取得被 INSERT,UPDATE 或者 DELETE 查询所影响到的行的数目,用 mysql_affected_rows()。 
      

  10.   

    如果数据库连接没问题,下面那个明显是用 
    mysql_num_rows($rs) 嘛~~~~~~
      

  11.   


    那你的$username=$_POST['username'];
    $email1=$_POST['email1'];
    $acctiveme=$_POST['acctiveme'];
    $password=md5($_POST['password']);
    $yanzheng=$_POST['yanzheng'];
    $question=$_POST['question'];
    $answer=$_POST['answer'];
    就要放在
    require_once("mywebmanage/conn.php");前面
      

  12.   

    你要确定conn.php有连接数据库。
      

  13.   

    无明显错误 你先屏蔽掉这句echo "<script>alert('恭喜您,注册成功!');location.href='reg.php';</script>";
    看下输出的sql语句是什么
      

  14.   

    insert into member(username,password,sex,email1,question,key) VALUES ('111111','7fa8282ad93047a4d6fe6111c93b308a','yes','[email protected]','你的爷爷叫什么?','111111')
      

  15.   

    函数定义不等于函数调用哦!“supplied argument is not a valid MySQL result resource”怎么会是这样的错误
      

  16.   


    $sql="insert into member(username,password,sex,email1,question,key) VALUES ('$username','$password','$acctiveme','$email1','$question','$answer')";
    echo $sql;
    $_SESSION['username']=$username;
    mysql_query($sql);
    echo "<script>alert('恭喜您,注册成功!');location.href='reg.php';</script>";改为
    $sql="insert into member(username,password,sex,email1,question,key) VALUES ('$username','$password','$acctiveme','$email1','$question','$answer')";
    mysql_query($sql) or die(mysql_error());
    if(mysql_affected_rows()) {
      $_SESSION['username']=$username;
      echo "<script>alert('恭喜您,注册成功!');location.href='reg.php';</script>";
    }