- 分享
- 0
- 人气
- 0
- 主题
- 2
- 帖子
- 2827
- UID
- 16446
- 积分
- 6008
- 阅读权限
- 23
- 注册时间
- 2005-8-18
- 最后登录
- 2018-3-15
- 在线时间
- 1428 小时
|
我最近面对一些问题。。。。
<?
$conn = mysql_connect("localhost","cinema","123456");
mysql_select_db("cinema");
if($_POST['submit']){
$username = $_POST['username'];
$password = $_POST['password'];
$checkUserQuery = mysql_query("SELECT * FROM cinema WHERE username='$username'");
if(!$username OR !$password){
echo("Error: Please enter a username and password");
}
elseif(mysql_num_rows($checkUserQuery)>0){
echo("Error: Username already exist!");
}
else{
$query = mysql_query("INSERT INTO cinema VALUES('','$username','$password')");
echo("Sign up successful!");
}
}
?>
<form method="post" action="">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit" value="Sign Up!">
当我执行的时候。。。。。这个出现
0){ echo("Error: Username already exist!"); } else{ $query = mysql_query("INSERT INTO cinema VALUES('','$username','$password')"); echo("Sign up successful!"); } } ?> |
|