Recently wrote the English search for thieves, in order to make the spider better enjoy the fun of the link, so the use of warehousing processing, the most recent search to the MySQL, and at the same time call these query data on the homepage, you can achieve the effect of the site map, but the drawbacks also appear, that is the problem of duplicate records.
Find an example on the Internet, after the modification found feasible, the code is published as follows:
$link =mysql_connect (' localhost ', ' root ', ' 1234 '); Get MySQL database connection
$username =$_get["name"]; Get the data from the client table conveys.
$q = "SELECT * from usertable where user_name= ' $username '";
mysql_query ("SET NAMES gb2312"); Avoid Chinese garbled
$rs = mysql_query ($q, $link); Querying the database
$num _rows = mysql_num_rows ($RS); Total number of rows obtained from query results
if ($num _rows==0)
Fire Web liehuo.net Welcome replication, Reject malicious collection liehuo.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 user)
echo "User registration success!";
}
Else
{
echo "This username already exists, please select User name again!";
}
?>