How to configure mysql remote php external network link database
、‘()’
、‘()’ 2019-01-12 11:09:47
0
3
1296
$con = mysql_connect("47.107.159.50:3306","root","root");

After using phpstudy to configure the mysql database on the Alibaba Cloud host, the php code is linked to the database. How to fill in the database address

、‘()’
、‘()’

reply all(2)
崇拜

Oh oh oh oh oh oh

刘宁
$host = '47.107.159.50';

$port = 3306;

$user = 'root';

$password = 'root';

$db_name = '表名';

if(!$con = mysqli_connect($host,$user,$password,$db_name,$port)){

echo "can not connect to databases";

}else{

if($db_name != ''){

//选择数据库

if(!mysqli_select_db($con,$db_name)){

echo "can not select database" . $db_name;

return false;

}

}

}

//发送语句

mysqli_query($con,"SET NAMES 'UTF8'");


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