Now I am trying to connect to a database that is on another PC, we are both on the same network, what happens is that this other PC presents an updated data table that is modified daily, so I need to do the queries there. we are both in the same network (mine 172.xx.xx.ab and the other PC is 172.xx.xx.aa) and the database presented is called "maintenance" and the table "address" , will there be any way to call the database from another PC in a PHP code?
I have made a way to consult, I mean like this:
<?php
//Opciones de la conexión
$opciones = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8");
//Objeto PDO, Controlador de BD, IP del servidor o localhost, nombre de la BD, usuario y contraseña
$objetoPDO = new PDO('mysql:host=172.xx.xx.ab;dbname=mantenimiento','root','',$opciones); ?>
and the error comes to me in the following way:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1130] Host '(hostanme)' is not allowed to connect to this MariaDB server' in C:\xampp\htdocs\j7\ejemplo.php:4 Stack trace: #0 C:\xampp\htdocs\j7\ejemplo.php(4): PDO->__construct('mysql:host=172...', 'root', '', Array) #1 {main} thrown in C:\xampp\htdocs\j7\ejemplo.php on line 4