This article introduces a simple example of connecting PHP to the MYSQL database in the LAN. if you need it, refer to it.
The code is as follows:
$ Conn = mysql_connect ('192. 168.0.220 ', 'root', '123 ');
If (! $ Conn) echo "failed! ";
Else echo "successful! ";
// SQL statement used to extract information from the table
$ SQL = "SELECT * FROM user where userName = '$ user_name '";
// Execute SQL query
$ Result = mysql_db_query ('info', $ SQL, $ conn );
// Obtain the query result
$ Row = mysql_fetch_row ($ result );
Mysql_close ();
The ip address of the first line corresponds to a host in the LAN. For more information about mysql connection in the LAN, see my excerpt.
Row 6 $ user_name is the parameter passed at the front end. it constitutes a condition query. the double quotation mark variable conversion is used here.
From jsp to php, the steps related to database connection are roughly as follows:
"Host, user name, password" to get the connection, "database, SQL, connection" to get the result, and finally the result is displayed. Of course, the database connection is done by the extended Database. All we can do is process the results.