mirror of
https://github.com/FranP-code/Allnews.com.git
synced 2025-10-13 00:32:45 +00:00
Configurada la conexion a base de datos y empezadas las consultas para extraer informacion
This commit is contained in:
17
index.php
17
index.php
@@ -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
7
mySQLconnect.php
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user