求高手帮我看一下 为什么这段代码会执行两次 添加一个用户会出现两个相同的
答案:3 悬赏:40 手机版
解决时间 2021-01-25 07:20
- 提问者网友:呐年旧曙光
- 2021-01-24 16:31
<?php<br><br> include("connect.php");<br> $user = $_REQUEST["user"];<br> $password = $_REQUEST["password"];<br> $password1 = $_REQUEST["password1"];<br> if($password!=$password1)<br><br> echo"<script language='javascript'> alert('两次密码输入不一样!'); history.go(-1); </script>"; <br><br>$sql = mysql_query("insert into tmanager (user,password) values('$user','$password')");<br> $row=mysql_fetch_object($sql);<br><br> if($row['user']!=0)<br><br> echo"<script language='javascript'> alert('用户名已存在,请重新输入!'); history.go(-1);</script>"; <br><br> else <br><br> echo"<script language='javascript'> alert('注册成功'); location='account.php'; </script>"; <br><br>?>
最佳答案
- 五星知识达人网友:梦中风几里
- 2021-01-24 17:31
<?php<br>include("connect.php");<br>$user = $_POST["user"];<br>$password = $_POST["password"];<br>$password1 = $_POST["password1"];<br>if($password!=$password1) <br> die("<script language='javascript'> alert('两次密码输入不一样!'); history.go(-1); </script>");//用echo下边会继续执行<br>$sql = mysql_query("insert into tmanager (user,password) values('$user','$password')")or die("<script language='javascript'> alert('用户名已存在,请重新输入!'); history.go(-1);</script>");//对user字段建唯一索引 <br>echo"<script language='javascript'> alert('注册成功'); location='account.php'; </script>";<br>?> <br><br>//出现两个相同的用户,估计是你注册成功的页面跳转有问题,
全部回答
- 1楼网友:迟山
- 2021-01-24 18:59
private sub commandbutton1_click()
dim rag1 as range, rag2 as range
sheets("a").cells.interior.pattern = xlnone
for each rag2 in range("a1:a" & range("a65536").end(xlup).row)
for each rag1 in worksheets("a").range("a1:a" & worksheets("a").range("a65536").end(xlup).row)
if rag1 = rag2 then
worksheets("a").rows(rag1.row & ":" & rag1.row).copy
rows(rag2.row & ":" & rag2.row).select
activesheet.paste
application.cutcopymode = false
worksheets("a").rows(rag1.row & ":" & rag1.row).interior.color = 255
end if
next
next
end sub
- 2楼网友:平生事
- 2021-01-24 18:05
建议先使用select查看数据库中有无该用户,然后再进行insert操作
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯
正方形一边上任一点到这个正方形两条对角线的 |
阴历怎么看 ? |