0% found this document useful (0 votes)
17 views1 page

New Text Document

This document contains PHP code to display book data from a database in a template. It queries the database for all books or books of a specific category, then loops through the results to output each book's name, image, description excerpt, price and add to cart button in HTML.

Uploaded by

Sun Pear
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views1 page

New Text Document

This document contains PHP code to display book data from a database in a template. It queries the database for all books or books of a specific category, then loops through the results to output each book's name, image, description excerpt, price and add to cart button in HTML.

Uploaded by

Sun Pear
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

<?

php
$sachdb=new sach_model();
if(isset($_GET['maloai']))
{
$booklist=$sachdb->sach1loai($_GET['maloai']);
}
else
$booklist=$sachdb->getall();
$tong=$sachdb->getrowcount();

foreach($booklist as $key)
{
?>

<div class="templatemo_product_box">
<h1><?php echo $key['tensach'];?></h1>
<img src="images/sach/<?php echo $key['hinh'];?>" alt="image" />
<div class="product_info">
<p><?php echo substr($key['mota'],0,50);?> </p>
<h3><?php echo $key['gia'];?></h3>
<form action="index.php" method="POST">
<input type="hidden" name="item" value="<?php echo $key['masach'] ?>">
<input type="submit" name="themitem" value="Mua" class="buy_now_button my-btn"
style="cursor:pointer;">
</form>
<div class="detail_button"><a href="#">Chi tiet ...</a></div>
</div>
</div>

<?php } ?>

You might also like