updated db info

This commit is contained in:
Joshua Perry 2022-11-16 19:25:32 +00:00
parent 88aebe81ac
commit d420691460
5 changed files with 7 additions and 7 deletions

2
db.php
View File

@ -3,7 +3,7 @@ function fetchCats() {
$server = 'mysql';
$username = 'student';
$password = 'student';
$schema = 'ibuy';
$schema = 'assignment1';
$pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password);
$stmt = $pdo->prepare('SELECT * FROM category');
$stmt->execute();

View File

@ -13,7 +13,7 @@ require '../../layout.php';
$server = 'mysql';
$username = 'student';
$password = 'student';
$schema = 'ibuy';
$schema = 'assignment1';
$pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password);
if (isset($_POST['submit'])) {
$stmt = $pdo->prepare('SELECT * FROM users WHERE email = :email');

View File

@ -3,7 +3,7 @@ function addUser() {
$server = 'mysql';
$username = 'student';
$password = 'student';
$schema = 'ibuy';
$schema = 'assignment1';
$pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password);
$stmt = $pdo->prepare('INSERT INTO users (first_name, last_name, email, password, admin)

View File

@ -21,7 +21,7 @@ function populateList($category) { //TODO: This will need to be updated to popul
$server = 'mysql';
$username = 'student';
$password = 'student';
$schema = 'ibuy';
$schema = 'assignment1';
$pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password);
if ($category === 'Latest Listings') {
@ -48,7 +48,7 @@ function populateList($category) { //TODO: This will need to be updated to popul
$output .= '<li>
<img src="assets/product.png" alt="product name">
<article>
<h2>'. $listing['name'] .'</h2>
<h2>'. $listing['title'] .'</h2>
<h3>'. $listing['categoryId'] .'</h3>
<p>'. $listing['description'] .'</p>
<p class="price">Current bid:'. $stmt->fetch()['MAX(amount)'] .'</p>

View File

@ -11,7 +11,7 @@ function populateContent() {
$server = 'mysql';
$username = 'student';
$password = 'student';
$schema = 'ibuy';
$schema = 'assignment1';
$pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password);
$stmt = $pdo->prepare('SELECT * FROM auction WHERE listing_id= :listing_id');
@ -44,7 +44,7 @@ function populateContent() {
$output = ' <img src="product.png" alt="product name">
<section class="details">
<h2>'. $listing['name'] .'</h2>
<h2>'. $listing['title'] .'</h2>
<h3>'. $category['name'] .'</h3>
<p>Auction created by <a href="#">'. $user['first_name'].$user['last_name'] .'</a></p>
<p class="price">Current bid: '. $bid['MAX(amount)'] .'</p>