Configurada la conexion a base de datos y empezadas las consultas para extraer informacion

This commit is contained in:
2021-07-09 22:52:53 -03:00
parent bfc3bcf646
commit 5789e56d67
3 changed files with 26 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="es">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -10,7 +10,20 @@
<body>
<header>
<h1>AllNews.com</h1>
</header>
</header>
<div class="article-container">
<?php
require 'mySQLconnect.php';
$selection = $mySQLconnect -> query('select * from noticias;')-> fetchAll();
print_r($selection);
?>
</div>
</body>
</html>

7
mySQLconnect.php Normal file
View File

@@ -0,0 +1,7 @@
<?php
try {
$mySQLconnect = new PDO('mysql:host=localhost;dbname=pagina_de_noticias', 'root', '');
} catch(PDOexception $e) {
echo "Error: " . $e -> getMessage();
}

View File

@@ -12,6 +12,8 @@ header {
padding-bottom: 4vh;
display: flex;
justify-content: center;
background-color: #00000020;
background-color: #00000050;
color: white;
}
user-select: none;
}