Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions End Term Practicals/CSEB/53/hello.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sample
14 changes: 14 additions & 0 deletions End Term Practicals/CSEB/q1/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
$hostname = "localhost";
$username = "root";
$password = "";
$databasename = "bookstore";

$conn = mysqli_connect($hostname, $username, $password, $databasename);
if($conn){
echo "Connection Established....";
}
else{
echo "Connection failed ";
}
?>
73 changes: 73 additions & 0 deletions End Term Practicals/CSEB/q1/details.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
include('config.php')
?>

<?php

if(isset($_POST['submit'])){

$bName = $_POST['bookname'];
$aName = $_POST['authorname'];
$isbnNumber = $_POST['isbnumber'];
$pName = $_POST['publishername'];
$pYear = $_POST['publicationyear'];
$bType = $_POST['booktype'];
$pages = $_POST['pages'];

$sql = "INSERT INTO `books` (`bookName`, `authorName`, `isbnNumber`, `publisherName`, `publicationYear`, `noOfPages`, `bookType`) VALUES ('$bName', '$aName', '$isbnNumber', '$pName', '$pYear', '$pages','$bType')";
if(!mysqli_query($conn, $sql)){
echo "Error1 ". mysqli_error($conn);
}
else{
echo "Data sent successfully....1";
}
}
else{
echo "please enter the details";
}

?>

<!DOCTYPE html>
<head>
</head>
<html>
<body>
<form method="POST" action="details.php">
Book Name <input type="text" placeholder="Enter Book Name" name="bookname"><br><br>
Author Name <input type="text" placeholder="Enter Author Name" name="authorname"><br><br>
ISBN Number <input type="text" placeholder="Enter ISBN Number" name="isbnumber"><br><br>
Publisher Name <input type="text" placeholder="Enter Publisher Name" name="publishername"><br><br>
<br>Publication Year<br>
<select name="publicationyear">
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
</select><br>
<br> Book Type <br>
Action <input type="radio" value="Action" name="booktype"><br>
Adventure <input type="radio" value="Adventure" name="booktype"><br>
Classics <input type="radio" value="Classics" name="booktype"><br>
Comic Book <input type="radio" value="Comic_Book" name="booktype"><br>
Graphic Novel <input type="radio" value="Graphic_Novel" name="booktype"><br>
Detective <input type="radio" value="Detective" name="booktype"><br>
Mystery <input type="radio" value="Mystery" name="booktype"><br>
Historical Fiction <input type="radio" value="Historical_Fiction" name="booktype"><br>
Horror <input type="radio" value="Horror" name="booktype"><br>
Literary Fiction <input type="radio" value="Literary_Fiction" name="booktype"><br>
<br>
Number Of Pages<br>
<input type="range" name="pages" min="200" max="400"> <br><br>
<input type="submit" value="submit" name="submit">
</form>
</body>
</html>
14 changes: 14 additions & 0 deletions End Term Practicals/CSEB/q2/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
$hostname = "localhost";
$username = "root";
$password = "";
$databasename = "bookstore";

$conn = mysqli_connect($hostname, $username, $password, $databasename);
if($conn){
echo "Connection Established....";
}
else{
echo "Connection failed ";
}
?>
52 changes: 52 additions & 0 deletions End Term Practicals/CSEB/q2/display.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
include('config.php')
?>

<?php
$sql = "select * from `books`";
$result = mysqli_query($conn, $sql);
if($result->num_rows > 0){
?>
<table border="1px">
<tr>
<th>BOOK ID</th>
<th>Book Name</th>
<th>Author</th>
<th>ISBN</th>
<th>Publisher</th>
<th>Publiction Year</th>
<th>Pages</th>
<th>Book Type</th>

</tr>
<?php
while($row = $result->fetch_assoc()){
?>
<tr>
<th><?php echo $row['id'] ?></th>
<th><?php echo $row['bookName'] ?></th>
<th><?php echo $row['authorName'] ?></th>
<th><?php echo $row['isbnNumber'] ?></th>
<th><?php echo $row['publisherName'] ?></th>
<th><?php echo $row['publicationYear'] ?></th>
<th><?php echo $row['noOfPages'] ?></th>
<th><?php echo $row['bookType'] ?></th>
</tr>
<?php
}
?>
</table>
<?php
}
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Display</title>
</head>
<body>

</body>
</html>