|
 |
|
insert session_id เข้า DB แต่มันไม่เข้าอ่ะครับ ไม่ทราบว่าผิดตรงไหน แล้วที่ DB ฟิลที่เก็บ seesion เข้าไปควรเป็นชนิดไหนครับ |
|
 |
|
|
 |
 |
|
1. ลอง echo session_id() ออกมาก่อนว่ามีค่าไหม
2. connect กับ database ได้แล้วแน่นะ
3. ลอง echo $strSQL ว่าค่าส่งมาครบไหม และ copy echo นั้นไป query ใน phpmyadmin ดูว่าลงหรือเปล่า
Code (PHP)
<?php
session_start();
$strProductID = $_POST["tProductID"];
$strQty = $_POST["tQty"];
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
if($strProductID != "" and $strQty != "")
{
$strSQL = "INSERT INTO cart ";
$strSQL .="(SID,ProductID,Qty) ";
$strSQL .="VALUES ";
$strSQL .="('".session_id()."','".$strProductID."','".$strQty."') ";
echo $strSQL;
//$objQuery = mysql_query($strSQL);
}
?>
SID ควรตั้งเป็น VARCHAR จ๊ะ
|
 |
 |
 |
 |
Date :
2012-01-06 16:27:13 |
By :
LuckyStar |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|