I've been working with php for some time and trying to make the MYSQL code work inside PHP, I'm working with PDO but at the moment I want to get the records from my database and put the print_r ($ variable); shows me an empty array.
<?php
function conexion(){
try {
$conexion = new PDO('mysql:localhost;dbname=u766373438','u766373438user', '1987');
return $conexion;
} catch(PDOException $e) {
return false;
}
}
$sql = conexion();
$table = $sql->prepare('SELECT * FROM ejemplo');
$table->execute();
$resultado = $table->fetchAll();
print_r($resultado);
? >