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'; $server = 'mysql';
$username = 'student'; $username = 'student';
$password = 'student'; $password = 'student';
$schema = 'ibuy'; $schema = 'assignment1';
$pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password); $pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password);
$stmt = $pdo->prepare('SELECT * FROM category'); $stmt = $pdo->prepare('SELECT * FROM category');
$stmt->execute(); $stmt->execute();

View File

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

View File

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

View File

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