I have a problem to connect to my webhost MYSQL from my localhost.
I have a host (www.printcity24.com) with mysql db and I use this code to connect to mysql db :
<?php
$db_path = mysqli_connect('printcity24.com', 'myuser', 'mypass', 'mydb', '3306');
if(!$db_path) {
echo mysqli_connect_error();
}else{
echo "Connected successfully";
}
?>
when i call this code from printcity24.com every thing is OK and connect to mysql db successfully.
but i created a localhost by xampp on my computer and when i call this code i got this error :
Warning: mysqli_connect(): MySQL server has gone away in C:\Program Files\XAMPP\htdocs\index.php on line 2
Warning: mysqli_connect(): (HY000/2006): MySQL server has gone away in C:\Program Files\XAMPP\htdocs\index.php on line 2 MySQL server has gone away
I talk to my web host admin and opened 3306 port on my host and added % to Manage Access Hosts on CPanel > remote MYSQL
but i still have problem to connection.