亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Common methods for connecting to MYSQL database with PHP
想無
想無 2021-09-07 13:56:33
0
3
1197

Configuring a Xiaoniao cloud server and deploying a PHP environment, what are the common methods for connecting to a MYSQL database?

想無
想無

reply all(3)
Z

You can refer to the following

<?php$con = mysql_connect("localhost","root","password");$select_db = mysql_select_db('test');if (!$select_db) { die("could not connect to the db:\n" . mysql_error());}//Query code $sql = "select * from db_table";$res = mysql_query($sql);if (!$res) { die("could get the res:\n" . mysql_error());}while ($row = mysql_fetch_assoc($res)) { print_r($row);}//Query code//Close the database connection mysql_close($ con);?>

yntdx

In fact, there are several common ways to deploy a PHP environment using Xiaoniao Cloud Server and connect to a MYSQL database. Here is the most common one: $mysql_server="localhost";$mysql_username="database username";$ mysql_password="database password";$mysql_database="database name";//Establish a database link//Select a database//Execute MySQL statements//Extract data

逆旅行人

The cloud server simulation environment is no different from the local one. First check whether mysql is successfully installed. You can connect using mysqli or pdo.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template