I have a virtual server and Xamp software is installed on it I have built in a MySQL service that can be easily controlled using database management software, but when I put the same user in PHP code and another server to remotely use the output And we will encounter the following errors
The above code is executed correctly at localhosts but does not run remotely
Problem not running query in MySQL database remotely
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$servername = "MyServer";
$username = "User";
$password = "MyPassword";
$dbname = "DBName";
$mysqli = new mysqli($servername, $username, $password,$dbname);
$result = $mysqli->query("SELECT * FROM users");
$row = $result->fetch_array();
echo $row['name'];
Eror :
Warning: mysqli::query(): Couldn't fetch mysqli in /home2/irpixeli/domains/irpixel.ir/public_html/dbsync.php on line 15 Fatal error: Uncaught Error: Call to a member function fetch_array() on bool in /home2/irpixeli/domains/irpixel.ir/public_html/dbsync.php:16 Stack trace: #0 {main} thrown in /home2/irpixeli/domains/irpixel.ir/public_html/dbsync.php on line 16