Location: PHPKode > projects > CoreAsset > coreasset/display_book.php
<?php
require_once("lib/inc.php");
require_once("lib/security.php");

$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$title	  ="::: Display Book :::";
$smarty->assign('title',$title);
// Date & Time to be dispalyed on the header 
$date_time	= date("h:i:s A")." ".date("d-m-Y");
$smarty->assign('date_time',$date_time);
// Done
$mes      = "";
$num      = "";
$status   = $_SESSION['status'];
$user_id  = $_SESSION['user_id'];
$smarty->assign('user_id',$user_id);
$row      = $database->get_from_database("select * from asset_users where user_id='$user_id'");
$name     = $row['full_name'];
$rw		  = $database->get_from_database("select * from asset_users where user_id='$_SESSION[user_id]'");
$last_login  = $rw['last_login'];
$last_logout = $rw['last_logout'];
$smarty->assign('last_login',$last_login);
$smarty->assign('last_logout',$last_logout);

$smarty->assign('status',$status);
//////////////////for category////////////////////////

$count_cat = $database->no_of_rows("select * from asset_category where category_name like 'book%';");
$smarty->assign('count_cat',$count_cat);	   


/////////////////////////////////////////////////////
  $query	="select * from asset_books";


$num = $database->no_of_rows($query);
    ////////////////////delete query///////////////////////
	
	
	if(isset($_GET['hd83___2y8dh328f____8hhdiw___jd9']))
    {
		 if($status < 4)
		 {
			$book_id = $_GET['hd83___2y8dh328f____8hhdiw___jd9'];
			if($database->delet("delete from asset_books where book_id='$book_id'"))
			{
				redirect ("display_book.php","Delete");
			}
		 }
	}
	
	
	//////////////////////////////////////////////////////
   if(isset($_GET['act']))
    {
     if($_GET['act']=="Add")
     {
      $mes = "Book is Successfully Created !";
     }
     if($_GET['act']=="Edit")
     {
      $mes = "Book is Successfully Updated !";
     }
     if($_GET['act']=="Delete")
     {
      $mes = "Book is Successfully Deleted !";
     }
     if($_GET['act']=="Exist")
     {
      $mes = "One or More Duplicate Entry of Book With Same ISBN Number has been Ignored...";
     }
    }


    if($num > 0)
    {
      $res          = $database->Execute($query);
      while($row1   = mysql_fetch_array($res))
      {
		   $book_id[]                          = $row1['book_id'];
		   $book_name[]                        = $row1['book_name'];
		   $author[]                           = $row1['author'];
		   $publisher[]                        = $row1['publisher'];
		   $isbn_no[]                          = $row1['isbn_no'];
		   $price[]                            = $row1['price'];
		   $receive_date[]                     = $row1['receive_date'];
		   $issued_user[]                      = $row1['issued_user'];
		   $status1[]                           = $row1['status'];
      }
	 // echo count($isbn_no);
	  
    $smarty->assign('book_id',$book_id);
    $smarty->assign('book_name',$book_name);
    $smarty->assign('author',$author);
    $smarty->assign('publisher',$publisher);
    $smarty->assign('isbn_no',$isbn_no);
    $smarty->assign('price',$price);
    $smarty->assign('receive_date',$receive_date);
    $smarty->assign('issued_user',$issued_user);
    $smarty->assign('status_book',$status1);

	//$smarty->assign('isbn_no',$isbn_no);
    }
	$smarty->assign('num',$num);
	$smarty->assign('mes',$mes);
	




$smarty->assign('name',$name);
$smarty->assign('status',$status);


$smarty->display('display_book.tpl');
?>
Return current item: CoreAsset