我想實現「保存」功能,該功能允許我的用戶保存從數據庫中呈現給他們的特定條目。例如,如果他們看到他們喜歡的東西,他們可以按「保存」按鈕,它將保存到「書籤」頁面。如何使用cookie實現具有動態內容的「保存」功能
這裏是我的代碼:
<?php
// Get all the data from the example table
$result = mysql_query("SELECT * FROM table WHERE item <> 0 ORDER BY id")
or die(mysql_error());
// keeps getting the next row until there are no more to get
$i = 10;
while ($i > 0) {
$i--;
$row = mysql_fetch_array($result);
if ($row['id'] != "") {
?>
<!-- Some content in this div-->
<div class="content">
<img src="<?php echo $row['logo']; ?>"/>
<?php echo $row['id']; ?>
</div>
<!-- This div will have the save icon that users can press -->
<div class="save">
<img src="images/saveIcon.png" />
</div>
<?php }} ?>
<div class="bookmarked">
Every single div that is labled as "content" that has been saved, will be displayed here.
</div>
問:我將如何實現一個功能,讓用戶從SQL特定ID(動態創建的內容)添加到cookie變量,因此它可以在以後再現。
那麼你有問題嗎? – JAAulde 2012-01-16 14:56:54
對不起 - 請參閱上面的說明。 – tushar747 2012-01-16 14:59:53