$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
$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 != ''){
//選擇數(shù)據(jù)庫(kù)
if(!mysqli_select_db($con,$db_name)){
echo "can not select database" . $db_name;
return false;
}
}
}
//發(fā)送語(yǔ)句
mysqli_query($con,"SET NAMES 'UTF8'");