Then create the file as follows, the 1th step is to connect the database, then write and then read.
Copy CodeThe code is as follows:
$mysql _server_name = "localhost";
$mysql _username = "root";
$mysql _password = "";
$mysql _database = "db";
Capture IP
$ip = getenv ("REMOTE_ADDR");
Establish connection-Through (server location, user name, user password)
$conn = mysql_connect ($mysql _server_name, $mysql _username, $mysql _password);
Prepare SQL syntax for this syntax for new data
$sql = "INSERT into ' num ' (' name ', ' IP ', ' new ') VALUES (' Badwolf ', ' $ip ', ' 1 ');";
Select the database you want to work with
mysql_select_db ($mysql _database, $conn);
To query
$result = mysql_query ($sql);
Result and release the connection
Mysql_close ($conn);
//------------------------------------------------------------------
The following is a printed material
Establish connection through (server location, user name, user password)
$conn = mysql_connect ($mysql _server_name, $mysql _username, $mysql _password);
Get ready for SQL syntax this syntax reads the data.
$sql = "Select COUNT (*) from ' num ' WHERE name= ' Badwolf '";
To query
$result = Mysql_db_query ($mysql _database, $sql, $conn);
To grab the results of a query
$row = Mysql_fetch_row ($result);
Print out all fields of the data
Print_r ($row);
Results after clearing a query
Mysql_free_result ($result);
?>
<title>Bad Wolf safety net PHP counter</title>
Bad Wolf safety net PHP counter
There have been a number of visitors since the opening
http://www.bkjia.com/PHPjc/319109.html www.bkjia.com true http://www.bkjia.com/PHPjc/319109.html techarticle then build the file as follows, the 1th step is to connect the database, then write and then read. Copy the code code as follows:! Doctypehtmlpublic "-//w3c//dtdxhtml1.0transitional//en" "Http://www.w3.org/TR/xhtml1/D ...