连接SQL数据的问题。。。。

lankj 2008-02-02 02:40:59
到取是否有重名帐号的时候就无任何显示了。。。不知道是不是连接数据库的语法有错。。。请各位指证。

<?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";
...全文
97 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
joycheney 2008-02-12
  • 打赏
  • 举报
回复
$rresult = mssql_query($query) or die("无法执行SQL:$query");

这句话出问题了,你没有加上你的数据库连接。。。。偶也经常笔误找不到错的地方。。。。。

$rresult = mssql_query($query,$conn) or die("无法执行SQL:$query");
剑心永远OK 2008-02-11
  • 打赏
  • 举报
回复
能否把问题说清楚点吗?
nxdawukous 2008-02-10
  • 打赏
  • 举报
回复
关注
张吉Jerry 2008-02-07
  • 打赏
  • 举报
回复
$result=mssql_query("select count(*) from users where name='$account'");
$row=mssql_fetch_row($result);
if($row[0]) 重名

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧