User name, password, address, are all right, here is my code, a great god taught,
<? PHP
The header (" content-type: text/HTML; Charset=utf-8 ");
//link to the mysql database, set up the server address, user name, address,
//constant parameters,
$dbname='ZUEUmNusqMJVLEhyYCCP';
/* from the environment variable parameter database connection need */
$host=getenv (" sqld-gz.bcehost.com ");
$port=getenv (' 3306 ');
$user=getenv (' 99 e349495cff4a95989bb74f511a8915 ');
$PWD=getenv (' 547 e172845af488ba82d76c3dfafcb49 ');
$conn=@ mysql_connect ($host, port, $user and $PWD) or die (' database link failure, error message: 'the. Mysql_error ());
//the second step is to select the database to link, and set the character set,
The mysql_select_db ($dbname, $conn) or die (' database error!!!!! Error message: ". Mysql_error ());
Mysql_query (' SET NAMES UTF8) or die (' character SET wrong!!!!! Error message: ". Mysql_error ());
//the third department, choose a list of the database, then put this table have been extracted from the database,
$query='SELECT * FROM art';
$result=mysql_query ($query) or die (' SQL error!!!!! Error message: ". Mysql_error ());
//$result is recordset
//the fourth step, can display the data in a recordset
Print_r (mysql_fetch_array ($result, MYSQL_ASSOC));
CodePudding user response:
The client can connect?CodePudding user response:
Mysql service open, he this is a used phpMyadmin operation managementCodePudding user response: