到取是否有重名帐号的时候就无任何显示了不知道是不是连接数据库的语法有错请各位指证。<?php
if(empty($_POST["account"])){
echo ("<script type='text/javascript'> alert('帐号不允许为空');history.go(-1);</script>");
exit;
}
if(empty($_POST["passwd"])){
echo ("<script type='text/javascript'> alert('密码不允许为空');history.go(-1);</script>");
exit;
}
if(empty($_POST["passwd2"])){
echo ("<script type='text/javascript'> alert('重复密码不允许为空');history.go(-1);</script>");
exit;
}if($_POST["passwd"]!==$_POST["passwd2"]){
echo ("<script type='text/javascript'> alert('两次密码不一样,请重新输入');history.go(-1);</script>");
exit;
}$account=$_POST["account"];
$passwd=$_POST["passwd"];
$question=$_POST["question"];
if(strlen($account)<6){
echo ("<script type='text/javascript'> alert('帐号不能小于6位');history.go(-1);</script>");
exit;
}
if(strlen($passwd)<6){
echo ("<script type='text/javascript'> alert('密码不能小于6位');history.go(-1);</script>");
exit;
}$aaa=$account.$passwd;
$md=md5($aaa);
$cc="0x";
$md52=$cc.$md;$conn=mssql_connect('127.0.0.1','sa','adder111');
$db = mssql_select_db("two",$conn) or die("无法连接stock数据库!");$query = "SELECT * FROM users WHERE (name = '$account')";
$rresult = mssql_query($query) or die("无法执行SQL:$query");
$last2=mssql_fetch_row($rresult);
if($last2){
echo ("<script type='text/javascript'> alert('您选用的帐号已经已经给注册了,请换个帐号重新注册');history.go(-1);</script>");
exit;
}
$query = "exec adduser '$account',$md52,'1','1','1','1','1','1','1','1','1','1','1','1',200811,'2',$md52";

解决方案 »

  1.   

    $result=mssql_query("select count(*) from users where name='$account'");
    $row=mssql_fetch_row($result);
    if($row[0]) 重名
      

  2.   

    $rresult   =   mssql_query($query)   or   die("无法执行SQL:$query"); 这句话出问题了,你没有加上你的数据库连接。偶也经常笔误找不到错的地方。。$rresult   =   mssql_query($query,$conn)   or   die("无法执行SQL:$query");