Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bdngeorge committed Dec 5, 2021
2 parents 6daaae5 + 9ecdb98 commit 0d314fc
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions account/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
$query = "SELECT * FROM users WHERE email = '$userEmail'";
$result = $db->query($query);
$record = $result->fetch_assoc();
$db->close();

$fname = $record['fname'];
$lname = $record['lname'];
Expand Down
17 changes: 17 additions & 0 deletions account/deleteBook.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
include("../includes/dbconnect.inc.php");
if($dbOK) {
$id = mysqli_real_escape_string($db, $_GET['id']);
$query = "Delete from books WHERE id = $id ";
$success = $db->query($query);
$db->close();
if ($success) {
header("Location: sellerCatalog.php");
} else {
echo "<div class = 'center-text'>
Your book was not deleted. Please try again
</div>";

}
}
?>
4 changes: 3 additions & 1 deletion account/sellerCatalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
$userEmail = mysqli_real_escape_string($db, $_SESSION['userEmail']);
// show all books sold by user
$query = "SELECT * from books where sellerEmail = '$userEmail'";

$result = $db->query($query);
$numRecords = $result->num_rows;
$db->close();

// if numRecords = 0, show message
for ($i=0; $i < $numRecords; $i++) {
Expand All @@ -45,6 +45,8 @@

echo "<a href='../catalog/bookInfo.php?id=$id'><img style='width:250px;height:300px;' src='../resources/bookImg/$file'></a>";

echo "<a href='deleteBook.php?id=$id'><p> Delete <p> </a>";

echo "<h5>$title</h5>";

echo "<p>".ucfirst($record['condition'])." - ";
Expand Down
1 change: 1 addition & 0 deletions catalog/bookInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$query = "SELECT * FROM books WHERE id = $id limit 1";
$result = $db->query($query);
$record = $result->fetch_assoc();
$db->close();

$title = $record['title'];
$authors = $record['authors'];
Expand Down
3 changes: 1 addition & 2 deletions catalog/uploadBooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
?>
</select>


<label class="field" for="cond" style="margin-top:20px"> <strong>Condition</strong> </label>
<select id="cond" name="cond">
<option value="poor">Poor</option>
Expand All @@ -122,7 +121,7 @@
<input type="file" id="file" name="file" accept="image/*"></br>


<input type="submit" name="submit" value="Submit" style="margin-top:20px">
<input type="submit" name="submit" value="Submit" style="margin-top:10px">
</form>
</section>

Expand Down
6 changes: 5 additions & 1 deletion styles/upload.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ h2 {
padding-bottom: 1vw;
font-variant: small-caps;
font-size: 3.5vw;
color: #449fee;
}

.body {
Expand All @@ -10,14 +11,17 @@ h2 {
display: flex;
flex-direction: column;
width: 50%;
height: 83%;
height: 85%;
margin-top: 100px;

}

.form {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-evenly;
padding-bottom: 15px;
}

input{
Expand Down

0 comments on commit 0d314fc

Please sign in to comment.