<?php
require_once '../library/config.php';
require_once '../library/functions.php';
//set the rank of books
$indexes = 1;
$sql = "SELECT book_id, book_name, book_image, book_date
FROM sc_books ";
$result = mysql_query($sql);
?>
<table width="100%" border="0" align="center"
cellpadding="9" cellspacing="4" >
<tr>
<th width="30" align="center">Index</th>
<th class ="middle" width="50" align="center">The book</th>
<th width="60" align="center">Date</th>
<th width="60" align="center">Update</th>
<th width="60" align="center">Remove</th>
</tr>
<?php
if (mysql_num_rows($result) == 0) {
?>
<tr bgcolor="#FFFFFF">
<td colspan="5">The list is empty .. </td>
</tr>
<?php
} else
{
while ($row = mysql_fetch_assoc($result)) {
extract($row);
?>
<tr bgcolor="#FFFFFF">
<td width="20" bgcolor = "#AFEEEE" align="center" cellpadding = "3">
<?php echo $indexes++; ?></td>
<td width = "60" align="center">
<a href="?page=detail_book&id_book=<?php echo $book_id; ?>">
<img src="../images/scbooks/<?php echo $row['book_image']; ?>" >
<br />
</a><a href="?page=detail_book&id_book=<?php echo $book_id; ?>">
<?php echo $book_name; ?></a></td>
<td class = "middle" width="60" bgcolor="#cfcfff" align="center">
<?php echo $row['book_date']; ?></td>
<td width="60" bgcolor="#FFE4E1" align="center"><a href="?page
=change_book&id_book=<?php echo $book_id; ?>">Update</a></td>
<td width="60" bgcolor="#E6E6FA" align="center"><a href=
"javascript:delete_book(<?php echo $book_id; ?>);">Remove</a></td>
</tr>
<?php
}
}
?>
<tr bgcolor="#FFFFFF">
<td colspan="5" align="center"><?php
?> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td class = "biscuit" color = "green" colspan="5" align="left">
<input background="#FCF4F4" type="button" name="button_add"
value="Add Book" onclick="window.location.href='indexoo.php?page=add_book';" /></td>
</tr>
</table>