In writing the registration system, if you want to check whether the user name exists, PHP can write:
Copy CodeThe code is as follows:
$username =$_request[' username '];
$password =$_request[' password '];
echo "
Excute the Insertuserinfo ";
$con =mysqli_connect ("localhost", "root", "" "," my_db ");
$sql = "SELECT * from user WHERE username= ' $username '";
Ho "
This username aready exists "; } else {$sql = "INSERT into user (Username,password) VALUES (' $username ', ' $password ')", if (!mysqli_query ($con, $sql)) {Ech O "
Error ". Mysqli_error ($con); } else {echo '
One record added "; } }
It is not recommended to use:
Copy CodeThe code is as follows:
Mysql_num_rows ($result)
Lt;pre name= "code" class= "HTML" >
http://www.bkjia.com/PHPjc/718603.html www.bkjia.com true http://www.bkjia.com/PHPjc/718603.html techarticle when registering the system, if you want to check whether the user name exists, PHP can write: Copy code as follows: $username =$_request[' username ']; $password =$_request[' password ']; ech ...