-
Notifications
You must be signed in to change notification settings - Fork 1
/
School_Books.php
103 lines (101 loc) · 2.36 KB
/
School_Books.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<html>
<style>
th{
padding:15px;
color:#fff;
text-shadow:1px 1px 1px #568F23;
border:1px solid #93CE37;
border-bottom:3px solid #9ED929;
background-color:#9DD929;
background:-webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.02, rgb(123,192,67)),
color-stop(0.51, rgb(139,198,66)),
color-stop(0.87, rgb(158,217,41))
);
background: -moz-linear-gradient(
center bottom,
rgb(123,192,67) 2%,
rgb(139,198,66) 51%,
rgb(158,217,41) 87%
);
-webkit-border-top-left-radius:5px;
-webkit-border-top-right-radius:5px;
-moz-border-radius:5px 5px 0px 0px;
border-top-left-radius:5px;
border-top-right-radius:5px;
}
td{
padding:10px;
text-align:center;
background-color:#DEF3CA;
border: 2px solid #E7EFE0;
-moz-border-radius:2px;
-webkit-border-radius:2px;
border-radius:2px;
color:#666;
text-shadow:1px 1px 1px #fff;
}
</style>
<form action="buy_1.php" method="POST">
<input type=number name="book_id">
<input type="submit" value="Buy Now">
</form>
<?php
// here host,user,password are like localdomain //
$con = mysql_connect('localhost','root','chetna');
if(!$con)
{
echo"not connected";
}
else
{
//echo "connected";
}
mysql_select_db("user");
// get the image from the db
$values="School Books";
$sql = "SELECT * FROM book_details where category='$values'";
// the result of the query
$sth = mysql_query($sql,$con);
if(!$sth)
{
die("Invalid query: " . mysql_error());
}
else
{
//echo "done";
}
echo "<table border='1'>
<tr><th>Book Id</th>
<th>Book Name</th>
<th>Publication</th>
<th>Author</th>
<th>Published year</th>
<th>Edition</th>
<th>Category</th>
<th>Price</th>
<th>Other Details</th>
<th>Image of the book</th>
</tr>";
while($row=mysql_fetch_array($sth))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['book_name'] . "</td>";
echo "<td>" . $row['publication'] . "</td>";
echo "<td>" . $row['author'] . "</td>";
echo "<td>" . $row['pub_year'] . "</td>";
echo "<td>" . $row['edition'] . "</td>";
echo "<td>" . $row['category'] . "</td>";
echo "<td>" . $row['price_org'] . "</td>";
echo "<td>" . $row['comment'] . "</td>";
$ro=$row['book_image'];
echo "<td>" ."<img src=\"$ro\" style=\"width:200px; height:100px;\">" ."</td>";
echo "</tr>";
}
echo "</table>";
?>
</html>