CSY2028-assignment-1/db.php

14 lines
326 B
PHP
Raw Normal View History

2022-11-16 13:27:51 +00:00
<?php
function fetchCats() {
$server = 'mysql';
$username = 'student';
$password = 'student';
$schema = 'ibuy';
$pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password);
2022-11-16 19:17:35 +00:00
$stmt = $pdo->prepare('SELECT * FROM category');
2022-11-16 13:27:51 +00:00
$stmt->execute();
$cats = $stmt->fetchAll();
return $cats;
2022-11-16 19:00:51 +00:00
}
?>