Recently wrote the English search for thieves, in order to let spiders better enjoy the fun of the link, so the use of storage processing, the recent search to write to MySQL, while the home page call these query data, you can reach the effect of the site map, but the drawbacks have also emerged, that is the problem of repeated records.
Find an example on the Internet, after modification found feasible, the code is now published as follows:
Copy to ClipboardWhat to refer to: [www.bkjia.com] $link =mysql_connect (' localhost ', ' root ', ' 1234 '); Get a MySQL database connection
$username =$_get["name"]; Get the data from the client table only son.
$q = "SELECT * from usertable where user_name= ' $username '";
mysql_query ("SET NAMES gb2312"); Avoid Chinese garbled characters
$rs = mysql_query ($q, $link); Querying the database
$num _rows = mysql_num_rows ($RS); Total number of rows to get query results
if ($num _rows==0)
Fire Network bkjia.com Welcome copy, refuse to collect liehuo malicious. Net
{
$exec = "INSERT into student (user_name) VALUES ($username)";
mysql_query ("SET NAMES gb2312");
mysql_query ($exec, $link); Insert data into the database without this user (registered users)
echo "User Registration successful! ";
}
Else
{
echo "The user name already exists, please re-select the user name!" ";
}
?>
http://www.bkjia.com/PHPjc/364720.html www.bkjia.com true http://www.bkjia.com/PHPjc/364720.html techarticle recently wrote the English search for thieves, in order to let spiders better enjoy the fun of the link, so the use of inbound processing, the most recent search to write to MySQL, while on the home page call these ...