購物清單
session_start();
$t_sql = "SELECT count(1) total FROM `products``";搜尋字串
$t_rs=my_qery($t_sql,$cnn)or die(mysql_error());
$t_row=mysql_fetch_assoc($t_rs);
$totalNum=$t_row['total'];
每頁顯示筆數
$perPage
總頁數
$totalPage
設定頁數
$pageNum
$beginIndex=$pageNum*$perPage;
加入搜尋串
$sql SELECT * FROM `products` LIMIT $beginIndex,$perPage;
設定變數$rs連結資料庫
$rs
判斷式search 有值時動作
<?php while($row=mysql_fetch_assoc($rs));?>
<div class="col-md-3">
<div class="thumbnail" style="height: 302px">
<a href=" product.php?sid=<?= $row['sid'] ?>"> <img src="imgs/small/<?= $row['book_id'] ?>.jpg" alt="..."></a>
<div class="caption">
<h5><?= $row['bookname'] ?></h5>
<p>
<?= $row['author'] ?>
</p>
<p><a class="btn btn-primary btn-sm" role="button">$ <?= $row['price'] ?></a>
<select class="qty">
<?php for ($i = 0; $i < 20; $i++): ?>
<option value="<?= $i ?>">
<?= $i ?>
</option>
<?php endfor ?>
</select>
<a data-p_sid="<?= $row['sid'] ?>" class="buy_btn btn btn-default btn-sm" role="button">加入購物車</a></p>
</div>
</div>
</div>
12/14 購物車 流程
Share This To :
0 意見:
張貼留言