<?php
    require_once '../library/config.php';
    require_once '../library/functions.php';
    is_logged();

    if (!isset($_GET['id_book'])) {
    echo "The book is not defined .. ";
    } else 
    {

    $id_book = $_GET['id_book'];
    $sql  = "SELECT book_id, book_name, book_description, book_image FROM sc_books WHERE book_id = $id_book";

    $result = mysql_query($sql) or die('Error: getting  book info is failed .. ' . mysql_error());

    if (mysql_num_rows($result) == 0) {
    ?>
    <p align="center">The book is not found, return to <a href="indexoo.php">here</a> the book list</p>
    <?php    
    } else {    
    $row = mysql_fetch_assoc($result);    
    ?>
    <link rel="stylesheet" type="text/css" href="../css/styles.css">
    <script language="JavaScript1.2" src="ThisScript.js" type="text/javascript"></script>

    
    <table width="100%" border="0" cellpadding="2" cellspacing="1">
    <tr> 
    <th width="150">book name</th>
    <td><?php echo $row['book_name']; ?>&nbsp; </td>
    </tr>
    <tr> 
    <th width="150">Description</th>
    <td><?php echo $row['book_description']; ?> </td>
    </tr>
    <tr> 
    <th width="150">Book image</th>
    <td><img src="../images/scbooks/<?php echo $row['book_image']; ?>"></td>
    </tr>
    <tr> 
    <tr><td>
     <br /> </td></tr>
    <td  width="150">&nbsp;</td>
    <td bgcolor = "#FFEFD5"><input  name="change_button" type="button" id="change_button" value="Update" onclick="window.location.href='indexoo.php?page=change_book&amp;id_book=<?php echo $id_book; ?>';" />
    <input  name="add_button" type="button" id="add_button" value="Add book" onclick="window.location.href='indexoo.php?page=add_book&book=<?php echo $id_book; ?>';" />
    <input  name="back_button" type="button" id="back_button" value="Back" onClick="window.history.back();"></td>
    </tr>
    </table>

    <?php
    }
    }
    ?>