This question already has an answer here:
This is my php file for my page that is displying my database
<?php
require 'head.php';
require 'testmysql.php';
?>
<?php
$results = $pdo->query('SELECT * FROM jobs');
foreach ($results as $row)
{
echo '<br>' . $row['id']. ' ' . $row['title']. ' ' .$row['salary']. ' ' . $row['location']. ' ' . $row['description']. '</br>';
}
?>
<?php
require 'foot.php';
?>
And this is my seperate file for the connection for my php
<?php
$server = 'localhost';
$username = 'root';
$password = 'admin';
$schema = 'vacancies';
$pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password);
?>
I am not really familiar with php and i have researched for some html table code for this but it failed everytime. I hope someone could help. Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire