正在学习无需刷新表单验证 碰到了一些mysql数据库问题 求解答
正在学习无需刷新表单验证 碰到了一些问题 求解答应该如何编写SQL语句啊
表单:
<form action="" method="post" name="form1" id="form1">
<fieldset>
<legend>账号基本数据</legend>
<label>账号:</label>
<input name="ID" type="text" onblur="sendRequest(this.value);" size="40" />
<span id="chkr"></span><br />
<label>密码:</label>
<input name="rPWD" type="password" size="40" />
<br />
<label> </label>
<span class="style1">a9527,是个重复账号</span>
</fieldset>
</form>
<?
$mysql_server_name = "localhost";
$mysql_username = "root";
$mysql_password = "123";
$mysql_database = "register";
mysql_connect( $mysql_server_name, $mysql_username, $mysql_password )
or die("database communication failed");
mysql_select_db($mysql_database);
// end of 开启资料库
$message = "";
$ID = $_GET['ID'];
$query = "SELECT username FROM users WHERE username = '$ID'";
$result = mysql_query($query);
if( mysql_num_rows($result) != 1 )
{
// The user ID specified was not found
$message = "False";
}
else
{
// The user ID found
$message = "True";
}
?>
<?php echo $message; ?>
真心求教