|
|
|
ช่วย แก้ให้ทีค่า โค้ดตะกร้าสินค้า พอกดหยิบสินค้าแล้วไม่มาขึ้นตรงตะกร้าอะค่ะ |
|
|
|
|
|
|
|
คือพอดีก๊อปโค้ดมาจากในหนังสืออะค่ะ
หน้า index พอกด หยิบสินค้า มันไม่แสดง อะค่ะ ช่วยแก้หน่อยนะค่ะ ขอบคุณมากๆค่ะ
อันนี้ ไฟล์ทั้งหมดนะค่ะ
http://www.upload-thai.com/download.php?id=42c38036f6e550d3708632a12ccbd594
Code (PHP)
<? session_start();
$sid = session_id(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Y-Commerce: Home</title>
<link rel="stylesheet" href="../css/style.css" />
<style>
.add_cart { font-size: 8pt; background-color: #CCBBFF; color: brown; }
.line_dot { border-top: dotted 1px gray; }
</style>
<script src="../ajax/framework.js"> </script>
<script>
function addCart(id) {
var data = "id=" + id;
var URL = "add_cart.php";
ajaxLoad('post', URL, data, "cart");
}
function readCart() {
ajaxLoad('post', "read_cart.php", null, "cart");
}
</script>
</head>
<body>
<?php include("header.inc.php"); ?>
<!-- µÒÃÒ§·ÕèãªéÇÒ§â¤Ã§ÃèÒ§¢Í§ÊèǹáÊ´§ÃÒ¡ÃÊÔ¹¤éÒáÅÐÃÒ¡ÒÃã¹Ã¶à¢ç¹ -->
<table width="600" align="center" style="border: solid 1px #cccccc;">
<tr valign="top">
<!-- ªèͧà«ÅÅì´éÒ¹«éÒ áÊ´§ÃÒ¡ÒÃÊÔ¹¤éÒ -->
<td width="430">
<p />
<!-- µÒÃÒ§ÂèÍ·Õè«é͹ÍÂÙèÀÒÂ㹪èͧà«ÅÅì´éÒ«éÒ à¾×èÍãËé¨Ñ´ÇÒ§¢éÍÁÙÅä´éµÒÁ·Õèµéͧ¡Òà -->
<table width="100%" bordercolor="gray" style="border-colllapse: collapse;">
<tr><td width="60"> </td><td width="200"> </td><td> </td></tr>
<?php
include("paging.inc.php");
include("dbconn.inc.php");
//¹Ó¡ÒÃáºè§à¾¨ÁÒãªé´éÇ à¼×è͡óÕÁÕÊÔ¹¤éҨӹǹÁÒ¡
$current_page = 1;
if(isset($_GET['page'])) {
$current_page = $_GET['page'];
}
$rows_per_page = 5;
$start_row = paging_start_row($current_page, $rows_per_page);
$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM product
LIMIT $start_row, $rows_per_page;";
$result = mysql_query($sql);
$found_rows = mysql_query("SELECT FOUND_ROWS();");
$total_rows = mysql_result($found_rows, 0, 0);
if($total_rows == 0) {
echo "<caption><b>äÁ辺ÃÒ¡ÒÃÊÔ¹¤éÒ</b></caption>";
}
else {
$stop_row = paging_stop_row($start_row, $rows_per_page, $total_rows);
echo "<caption><b>ÃÒ¡ÒÃÊÔ¹¤éÒÅӴѺ·Õè: " . ($start_row + 1) .
" - " . "$stop_row ¨Ò¡·Ñé§ËÁ´ $total_rows </b></caption>";
}
while($p = mysql_fetch_array($result)) {
$id = $p['pro_id'];
//¤Ó͸ԺÒÂÊÔ¹¤éÒ áÊ´§à¾Õ§ 100 ÍÑ¡¢ÃÐáá
$descr = substr($p['description'], 0, 80) . "...";
echo "
<tr valign=top>
<td rowspan=2 align=center>
<img width=50 src=read_image.php?pid=$id />
</td>
<td colspan=2>
<a href=product_detail.php?id=$id><b>{$p['pro_name']}</b></a> <br />
$descr
</td>
</tr>
<tr valign=bottom>
<td>
ÃÒ¤Ò: {$p['price']} ºÒ·
</td>
<td align=right>
<input type=button value=หยิบใส่รถเข็น class=add_cart
onClick=\"addCart($id)\" />
</td>
</tr>
<tr><td colspan=3 class=line_dot> </td></tr>";
}
?>
</table>
<p align="center">
<?php
//áÊ´§ËÁÒÂàŢྨ
$page_range = 5;
$qry_str = "";
$total_pages = paging_total_pages($total_rows, $rows_per_page);
$pagenum = paging_pagenum($current_page, $total_pages,
$page_range, $qry_str);
echo "˹éÒ: " . $pagenum;
?>
</td>
<!-- ªèͧà«ÅÅì´éÒ¹¢ÇÒ áÊ´§ÃÒ¡ÒÃÊÔ¹¤éÒ·ÕèÍÂÙèã¹Ã¶à¢ç¹ -->
<td id="cart" bgcolor="#eeeeff">
<?
include("read_cart.php");
?>
<script>readCart();</script>
</td>
</tr>
</table>
<p> </p>
</body>
</html>
Tag : Ajax, Web (ASP.NET), Windows
|
ประวัติการแก้ไข 2014-03-06 23:00:21
|
|
|
|
|
Date :
2014-03-06 22:26:37 |
By :
Nitar |
View :
699 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ต้องการความช่วยเหลือจริงๆค่า
|
|
|
|
|
Date :
2014-03-07 10:50:19 |
By :
Nitar |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จาก Code มันไม่น่าจะมีอะไรเกี่ยวข้องเลยครับ
|
|
|
|
|
Date :
2014-03-08 06:58:59 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|