|
 |
|
ปัญหาเกี่ยวกับ รถเข็น ผมทำ e-commerce ขายหนังสือ แต่ ปัญหาคือ เมื่อ user เข้ามาสั่งซื้อสินค้า แล้ว แต่ยังไม่ชำระเงิน |
|
 |
|
|
 |
 |
|
cart.php
<?
include("chek_session_login.php");
include("conn.php");
/* if($id==""){
echo"<script>alert('คุณยังไม่มีสินค้าในตะกร้า เชิญเลือกสินค้าของเราก่อน')</script>";
echo"<script>location='product_orders.php'</script>";
}*/
$result = mysql_query("select * from mem where username='$_SESSION[username]'") or die ("Err Can not to result") ;
$dbarr = mysql_fetch_array($result) ;
?>
<form id="form2" name="form1" method="post" action="confirm_order.php?id=<? echo $row["product_code"]?>" OnClick="return Conf(this)">
<table width="600" height="493" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="600" height="125" align="center" valign="top"><table width="600" align="left" cellpadding="0" cellspacing="1" bordercolor="#00FF00">
<tr>
<td width="103" bgcolor="#669900"><div align="center" class="style1 style2 style5"><strong>รหัสสินค้า</strong></div></td>
<td width="228" bgcolor="#669900"><div align="center" class="style9"><strong>ชื่อสินค้า</strong></div></td>
<td width="154" bgcolor="#669900"><div align="center" class="style9"><strong>ราคา</strong></div></td>
<td width="184" bgcolor="#669900"><div align="center" class="style9"><strong>จำนวน</strong></div></td>
<td width="113" bgcolor="#669900" class="style7"><div align="center" class="style159"><strong>รวม</strong></div></td>
</tr>
<?
$sql = "select cart.* , product.product_name , product.price_sale from cart , product
where cart.product_code = product.product_code ";
$result=mysql_query($sql)or die(mysql_error());
while($row=mysql_fetch_array($result))
{
?>
<tr>
<td height="20" bgcolor="#FFFF99"><div align="center" class="style182 style49 style164 style15 style1 style11"><strong><font color="#000000"><? echo $row["product_code"] ?></font></strong></div></td>
<td bgcolor="#FFFF99"><div align="center" class="style182 style49 style164 style15 style1 style11"><strong><font color="#000000"><? echo $row["product_name"] ?></font></strong></div></td>
<td bgcolor="#FFFF99"><div align="center" class="style182 style49 style164 style15 style1 style11"><strong><font color="#000000"><? echo $row["price_sale"] ?></font></strong></div></td>
<td align="center" bgcolor="#FFFF99"><span class="style11 style1 style15 style49 style49 style49 style49 style186 style164"><span class="style11 style1 style15 style49 style49 style49 style49 style159 style164"><span class="style182 style49 style15 style1 style11"><strong><font color="#000000"><? echo $row["amount"] ?></font></strong></span></span></span></td>
<td align="center" bgcolor="#FFFF99"><span class="style11 style1 style15 style49 style49 style49 style49 style186 style164"><span class="style11 style1 style15 style49 style49 style49 style49 style159 style164"><span class="style182 style49 style15 style1 style11"><strong> <font color="#000000">
<? $total = $row["price_sale"] * $row["amount"];
$net = $net + $total ;//ผลรวมทั้งใบเสร็จ
echo number_format($total,2);
?>
</font> </strong></span></span></span></td>
</tr>
<? } ?>
</table></td>
</tr>
<tr>
<td height="368" align="center"><table width="226" height="21" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="82" height="18" align="center" background="image/1.png" bgcolor="#669900"><span class="style14 style1 style12 style164 style159 style50">รวมทั้งสิ้น</span></td>
<td width="72" align="center" bgcolor="#FFFF66"><div align="center" class="style11 style1 style12"><? echo number_format($net,2); ?></div></td>
<td align="center" background="image/1.png" bgcolor="#669900" class="style14 style12 style1 style164 style159 style51"><font color="#FFFFFF">บาท</font></td>
</tr>
</table>
<p> </p>
<table width="536" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="32" colspan="2"><div align="center" class="style9 style187"><strong>ที่อยู่ผู้รับ</strong></div>
<span class="style49 style49">
<label></label>
</span></td>
<td width="292" rowspan="6" align="left"> </td>
</tr>
<tr>
<td width="120" background="image/body_bg12.jpg"><span class="style53">ชื่อสมาชิก</span></td>
<td width="304" align="left"><span class="style49 style49">
<?
$sql= "select * from mem where username='$_SESSION[username]' ";
$result=mysql_query($sql)or die(mysql_error());
$row=mysql_fetch_array($result);
?>
</span>
<input name="txtname" type="text" id="txtname" value="<? echo $row["name"]?>" size="30" /></td>
</tr>
<tr>
<td height="91" background="image/body_bg12.jpg"><div align="center" class="style53">ที่อยู่</div></td>
<td align="left"><span class="style49 style49">
<label>
<textarea name="txtaddress" id="txtaddress" cols="35" rows="5"><? echo $row["address"]?></textarea>
</label>
</span></td>
</tr>
<tr>
<td background="image/body_bg12.jpg"><div align="center" class="style53">เบอร์โทร</div></td>
<td align="left"><span class="style49 style49">
<label>
<input name="txttel" type="text" id="txttel" value="<? echo $row["tel"]?>" size="30" />
</label>
</span></td>
</tr>
<tr>
<td background="image/body_bg12.jpg"><div align="center" class="style53">Email</div></td>
<td align="left"><span class="style49 style49">
<label>
<input name="txtemail" type="text" id="txtemail" value="<? echo $row["email"]?>" size="30" />
</label>
</span></td>
</tr>
<tr>
<td height="24" colspan="2" align="center"><label></label>
<input type="submit" name="button" id="button" value="ยืนยันการสั่งซื้อ" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
payment
include("chek_session_login.php");
include("conn.php");
/* if($id==""){
echo"<script>alert('คุณยังไม่มีสินค้าในตะกร้า เชิญเลือกสินค้าของเราก่อน')</script>";
echo"<script>location='product_orders.php'</script>";
}*/
$result = mysql_query("select * from mem where username='$_SESSION[username]'") or die ("Err Can not to result") ;
$dbarr = mysql_fetch_array($result) ;
?>
<form id="form2" name="form1" method="post" action="confirm_order.php?id=<? echo $row["product_code"]?>" OnClick="return Conf(this)">
<table width="600" height="493" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="600" height="125" align="center" valign="top"><table width="600" align="left" cellpadding="0" cellspacing="1" bordercolor="#00FF00">
<tr>
<td width="103" bgcolor="#669900"><div align="center" class="style1 style2 style5"><strong>รหัสสินค้า</strong></div></td>
<td width="228" bgcolor="#669900"><div align="center" class="style9"><strong>ชื่อสินค้า</strong></div></td>
<td width="154" bgcolor="#669900"><div align="center" class="style9"><strong>ราคา</strong></div></td>
<td width="184" bgcolor="#669900"><div align="center" class="style9"><strong>จำนวน</strong></div></td>
<td width="113" bgcolor="#669900" class="style7"><div align="center" class="style159"><strong>รวม</strong></div></td>
</tr>
<?
$sql = "select cart.* , product.product_name , product.price_sale from cart , product
where cart.product_code = product.product_code ";
$result=mysql_query($sql)or die(mysql_error());
while($row=mysql_fetch_array($result))
{
?>
<tr>
<td height="20" bgcolor="#FFFF99"><div align="center" class="style182 style49 style164 style15 style1 style11"><strong><font color="#000000"><? echo $row["product_code"] ?></font></strong></div></td>
<td bgcolor="#FFFF99"><div align="center" class="style182 style49 style164 style15 style1 style11"><strong><font color="#000000"><? echo $row["product_name"] ?></font></strong></div></td>
<td bgcolor="#FFFF99"><div align="center" class="style182 style49 style164 style15 style1 style11"><strong><font color="#000000"><? echo $row["price_sale"] ?></font></strong></div></td>
<td align="center" bgcolor="#FFFF99"><span class="style11 style1 style15 style49 style49 style49 style49 style186 style164"><span class="style11 style1 style15 style49 style49 style49 style49 style159 style164"><span class="style182 style49 style15 style1 style11"><strong><font color="#000000"><? echo $row["amount"] ?></font></strong></span></span></span></td>
<td align="center" bgcolor="#FFFF99"><span class="style11 style1 style15 style49 style49 style49 style49 style186 style164"><span class="style11 style1 style15 style49 style49 style49 style49 style159 style164"><span class="style182 style49 style15 style1 style11"><strong> <font color="#000000">
<? $total = $row["price_sale"] * $row["amount"];
$net = $net + $total ;//ผลรวมทั้งใบเสร็จ
echo number_format($total,2);
?>
</font> </strong></span></span></span></td>
</tr>
<? } ?>
</table></td>
</tr>
<tr>
<td height="368" align="center"><table width="226" height="21" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="82" height="18" align="center" background="image/1.png" bgcolor="#669900"><span class="style14 style1 style12 style164 style159 style50">รวมทั้งสิ้น</span></td>
<td width="72" align="center" bgcolor="#FFFF66"><div align="center" class="style11 style1 style12"><? echo number_format($net,2); ?></div></td>
<td align="center" background="image/1.png" bgcolor="#669900" class="style14 style12 style1 style164 style159 style51"><font color="#FFFFFF">บาท</font></td>
</tr>
</table>
<p> </p>
<table width="536" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="32" colspan="2"><div align="center" class="style9 style187"><strong>ที่อยู่ผู้รับ</strong></div>
<span class="style49 style49">
<label></label>
</span></td>
<td width="292" rowspan="6" align="left"> </td>
</tr>
<tr>
<td width="120" background="image/body_bg12.jpg"><span class="style53">ชื่อสมาชิก</span></td>
<td width="304" align="left"><span class="style49 style49">
<?
$sql= "select * from mem where username='$_SESSION[username]' ";
$result=mysql_query($sql)or die(mysql_error());
$row=mysql_fetch_array($result);
?>
</span>
<input name="txtname" type="text" id="txtname" value="<? echo $row["name"]?>" size="30" /></td>
</tr>
<tr>
<td height="91" background="image/body_bg12.jpg"><div align="center" class="style53">ที่อยู่</div></td>
<td align="left"><span class="style49 style49">
<label>
<textarea name="txtaddress" id="txtaddress" cols="35" rows="5"><? echo $row["address"]?></textarea>
</label>
</span></td>
</tr>
<tr>
<td background="image/body_bg12.jpg"><div align="center" class="style53">เบอร์โทร</div></td>
<td align="left"><span class="style49 style49">
<label>
<input name="txttel" type="text" id="txttel" value="<? echo $row["tel"]?>" size="30" />
</label>
</span></td>
</tr>
<tr>
<td background="image/body_bg12.jpg"><div align="center" class="style53">Email</div></td>
<td align="left"><span class="style49 style49">
<label>
<input name="txtemail" type="text" id="txtemail" value="<? echo $row["email"]?>" size="30" />
</label>
</span></td>
</tr>
<tr>
<td height="24" colspan="2" align="center"><label></label>
<input type="submit" name="button" id="button" value="ยืนยันการสั่งซื้อ" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
ผมทำ e-commerce ขายหนังสือ แต่ ปัญหาคือ เมื่อ user เข้ามาสั่งซื้อสินค้า แล้ว แต่ยังไม่ชำระเงิน สินค้าก็จะถูเก็บไว้ แต่เมื่อ user อื่นเข้มาใช้บริการก็จะเห็น สินค้าที่ อีก user หนึ่ง สั่งไว้ แลพเมื่อ กด ตรวจสอบการสั่งซื้อ ก็จะสามารถ สั่งซื้อแทนกันได้ คับ ปัญหา คือ ไม่สามารถทำให้เป้นส่วนตัวได้แบบว่า ของใครของมันนะคับ ใครรู้ช่วยบอกที่ ผมทำมา 3 วันแล้วยังไม่ได้เลยอะคับ
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2011-01-02 16:03:59 |
By :
pissanu101 |
View :
1011 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองไปเพิ่มฟิวในตารางดูนะคับเช่น
product_order
-id_product
-date
ก็เพิ่มฟิว user เข้าไป ก็จะเป็น
product_order
-id_product
-date
-user
พอตอนเรียกมาก็
select * from product_order where user="$_SESSION[username]"
ลองดูนะคับ ว่าได้ป่าว
|
 |
 |
 |
 |
Date :
2011-01-02 17:21:57 |
By :
dekcomnvc |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|