|
 |
|
ผมอยากโชว์ชื่อสมาชิก แล้วก็นำชื่อสมาชิกนั้นลงในถานข้อมูลของตะกร้าด้วยคับ |
|
 |
|
|
 |
 |
|
Code (PHP)
<?php
<?php
session_start() ;
if(!session_is_registered("login_true")) {
echo "<meta http-equiv='refresh' content='0;url=index.php'>" ;
exit() ;
}
?>
<html>
<head>
<title>::SHOPPING::</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="E8E8E8">
<strong><font color="#FF6633" size="1" face="MS Sans Serif, Tahoma, sans-serif">
<?php
include("config.inc.php") ;
mysql_select_db($db) ;
$result = mysql_query("select * from member where user='$login_true'") or die ("Err Can not to result") ;
$dbarr = mysql_fetch_array($result) ;
?>
สวัสดี <?php echo $dbarr['name'] ; ?> ///////ผมอยากให้ชื่อตรงนี้ ครับ ลงไปในถานข้อมูล preview ด้วยคับ ผมต้องทำไงคับเนี๊ยช่วยบอกทีคับ////////
</font> </strong>
<?
include "connect.php";
$member=$_POST[ddlname];
$cdmp3=$_POST[ddlcdmp3type];
$monitor=$_POST[ddlmonitor];
$spaeker=$_POST[ddlspaeker];
$amp=$_POST[ddlamp];
$subwoofer=$_POST[ddlsubwoofer];
if ($cdmp3!=""){
$sql = "select * from cdmp3type where cdmp3type_id = '$cdmp3'";
$result = mysql_db_query($dbname,$sql);
$num = mysql_num_rows($result);
if ($num>0){
while($row=mysql_fetch_array($result)){
$namepro=$row[cdmp3type_name];
$pricepro=$row[pricecdmp3];
$imgpro=$row[cdmp3_img];
}
}
$sql = "INSERT INTO priview (name_pro, price_pro) VALUES ('$namepro', '$pricepro')";
$result=mysql_db_query($dbname,$sql);
if ($result){
echo "<tr><td align='center'><b>ท่านได้สั่งซื้อ<font color='#0CB829'> $namepro </font>แล้ว</b></td></tr>";
}else{
echo "<tr><td align='center'><font color='red'><br><b>เพิ่มข้อมูล $namepro ไม่สำเร็จ</b><br></font></td></tr>";
}
}
if ($monitor!=""){
$sql = "select * from monitortype where monitortype_id = '$monitor'";
$result = mysql_db_query($dbname,$sql);
$num = mysql_num_rows($result);
if ($num>0){
while($row=mysql_fetch_array($result)){
$namepro=$row[monitortype_name];
$pricepro=$row[pricemonitor];
}
}
$sql = "INSERT INTO priview (name_pro, price_pro) VALUES ('$namepro', '$pricepro')";
$result=mysql_db_query($dbname,$sql);
if ($result){
echo "<tr><td align='center'><b>เพิ่มข้อมูล<font color='#0CB829'> $namepro </font>แล้ว</b></td></tr>";
}else{
echo "<tr><td align='center'><font color='red'><br><b>เพิ่มข้อมูล $namepro ไม่สำเร็จ</b><br></font></td></tr>";
}
}
if ($spaeker!=""){
$sql = "select * from spaekertype where spaekertype_id = '$spaeker'";
$result = mysql_db_query($dbname,$sql);
$num = mysql_num_rows($result);
if ($num>0){
while($row=mysql_fetch_array($result)){
$namepro=$row[spaekertype_name];
$pricepro=$row[pricespaeker];
}
}
$sql = "INSERT INTO priview (name_pro, price_pro) VALUES ('$namepro', '$pricepro')";
$result=mysql_db_query($dbname,$sql);
if ($result){
echo "<tr><td align='center'><b>เพิ่มข้อมูล<font color='#0CB829'> $namepro </font>แล้ว</b></td></tr>";
}else{
echo "<tr><td align='center'><font color='red'><br><b>เพิ่มข้อมูล $namepro ไม่สำเร็จ</b><br></font></td></tr>";
}
}
if ($amp!=""){
$sql = "select * from amptype where amptype_id = '$amp'";
$result = mysql_db_query($dbname,$sql);
$num = mysql_num_rows($result);
if ($num>0){
while($row=mysql_fetch_array($result)){
$namepro=$row[amptype_name];
$pricepro=$row[priceamp];
}
}
$sql = "INSERT INTO priview (name_pro, price_pro) VALUES ('$namepro', '$pricepro')";
$result=mysql_db_query($dbname,$sql);
if ($result){
echo "<tr><td align='center'><b>เพิ่มข้อมูล<font color='#0CB829'> $namepro </font>แล้ว</b></td></tr>";
}else{
echo "<tr><td align='center'><font color='red'><br><b>เพิ่มข้อมูล $namepro ไม่สำเร็จ</b><br></font></td></tr>";
}
}
if ($subwoofer!=""){
$sql = "select * from subwoofertype where subwoofertype_id = '$subwoofer'";
$result = mysql_db_query($dbname,$sql);
$num = mysql_num_rows($result);
if ($num>0){
while($row=mysql_fetch_array($result)){
$namepro=$row[subwoofertype_name];
$pricepro=$row[pricesubwoofertype];
}
}
$sql = "INSERT INTO priview (name_pro, price_pro) VALUES ('$namepro', '$pricepro')";
$result=mysql_db_query($dbname,$sql);
if ($result){
echo "<tr><td align='center'><b>เพิ่มข้อมูล<font color='#0CB829'> $namepro </font>แล้ว</b></td></tr>";
}else{
echo "<tr><td align='center'><font color='red'><br><b>เพิ่มข้อมูล $namepro ไม่สำเร็จ</b><br></font></td></tr>";
}
}
?>
</body>
</html>
ช่วยทีคับโปรเจ็คพรีเซ็นวันพะรึหัดนี้แล้วคับ
?>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-09-16 01:57:48 |
By :
manowsjidd |
View :
973 |
Reply :
7 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แล้วต้องการ เก็บที่ column ไหน ครับ เห็นตาราง priview มีการ insert แค่ 2 column เองนิครับ
ปกติตารางร priview มีกี่ column ละครับ ถ้ามีแค่ 2 ก็ต้องเพิ่ม column อีก 1 เพื่อเก็บตัว
$dbarr['name'] แต่ปกติเค้าผมไม่นิยมเก็บ ชื่อ นะครับ นิยมเก็บ id มากกว่า
|
 |
 |
 |
 |
Date :
2009-09-16 08:11:33 |
By :
DownsTream |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมสร้างแล้วครับทั้งหมด 4 colum ก็คือ id กับ name คับ
ช่วยหน่อยนะคับพุ่งนี้ผมพรีเซ้นคับ
|
 |
 |
 |
 |
Date :
2009-09-16 15:35:32 |
By :
manowsjidd |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำถึงไหนแล้วหล่ะครับ แล้วติดปัญหาอะไรอยู่
|
 |
 |
 |
 |
Date :
2009-09-16 15:38:59 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เสร็จทุกอย่างแล้วครับเหลือแค่
ให้ชื่อสมาชิกที่ซื้อสินค้าลงไปอยู่ในถานข้อมูล preview เพื่อให้ adminรูว่าใครซื้อสินค้าไปบ้างอ่าคับ
|
 |
 |
 |
 |
Date :
2009-09-16 16:04:17 |
By :
manowsjidd |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ชื่อสมาชิกและรายการสินค้า คุณเก็บไว้ที่ไหน เช่น Session หรือเปล่า?
ถ้าใช่ ก็เอารายการพวกนั้น Insert เข้าไปที่ Table ครับ
PHP MySQL Add/Insert Record
|
 |
 |
 |
 |
Date :
2009-09-16 16:45:47 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอคุณครับจะลองทำดูนะคับ
ไม่ได้ยังไงเด้วมาบอกอีกที
|
 |
 |
 |
 |
Date :
2009-09-16 17:11:41 |
By :
manowsjidd |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำไม่ได้อ่าคับ
ได้แค่โชว์ออนไลน์อยู่
แต่ว่ามันไม่ยอมลงไปในtable คับผมแค่อยากให้ชื่อเนี๊ยลงไปใน table preview มันไม่ได้ซักที
table preview ประกอบด้วย
member_id มาจากtable member
name มาจากtable member
แล้วก็มี name_pro
price_pro
date
อยากให้ชื่อสมาชิกที่login เข้ามาซื้อของแล้วก็นำชื่อเนี๊ยลงในpreview เหลือแค่ตัวเดียวเนี๊ยคับ
|
 |
 |
 |
 |
Date :
2009-09-16 19:26:49 |
By :
manowsjidd |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|