เพิ่มข้อมูลได้แต่ไม่ขึ้นในฐานข้อมูล

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: เพิ่มข้อมูลได้แต่ไม่ขึ้นในฐานข้อมูล

Re: เพิ่มข้อมูลได้แต่ไม่ขึ้นในฐานข้อมูล

โดย mindphp » 20/12/2008 6:47 am

รู้ได้อย่างไรครับ ว่า ข้อมูลเข้าไปในฐานข้อมูลแล้ว

เพิ่มข้อมูลได้แต่ไม่ขึ้นในฐานข้อมูล

โดย moonoii » 19/12/2008 4:37 pm

ตอนนี้กำลังทำเว็บไซต์เกี่ยวกับ E-commerce ใช้ PHP และ Phpmyadmin ตอนนี้มีปัญหาในหน้าของการเพิ่มข้อมูลสินค้า คือ เราสามารถเพิ่มข้อมูลได้แต่กลับไม่ขึ้นในฐานข้อมูล ทำไงดีค่ะ รบกวนช่วยดูหน่อยค่ะ

โค้ดหน้าเพิ่มข้อมูลสินค้า
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<style type="text/css">
<!--
a:link {
color: #0033FF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #0000FF;
}
a:hover {
text-decoration: none;
color: #FF0000;
}
a:active {
text-decoration: none;
color: #0000FF;
}
.style6 {font-size: 2}
-->
</style></head>


</head>

<body>
<table width="804" border="1" align="center" bordercolor="#CCCCCC">
<tr valign="top" bordercolor="#CCCCCC">
<td colspan="3" ><?php include("headadmin.htm"); ?></td>
</tr>
<tr valign="top" bordercolor="#CCCCCC">
<td width="804" height="349" valign="middle" ><FORM METHOD=POST enctype="multipart/form-data" ACTION="addnewproduct.php">
&nbsp;
<table width="350" border="0" align="center" bgcolor="#FF9900">
<tr>
<td><center>
<font color="black"><b>
</b></font>
<div align="center"><font color="black"><b>เพิ่มรายการพัสดุใหม่!!</b></font></div>

</center></td>
</tr>
<tr bgcolor="#DBDBDB">
<td bgcolor="#DBDBDB" >&nbsp;&nbsp;&nbsp;<font size="2">ประเภทพัสดุ :&nbsp;
<select name="producttype_id" id="select" selected="เลือกประเภทพัสดุ">
<?
include("connect.php");
connect();
$rsgroup = mysql_query("select * from product_type");
if($nrecgroup = mysql_num_rows($rsgroup)>0)
{
echo"<option value=nullgroup>เลือกประเภทพัสดุ</option>";
while($rowgroup = mysql_fetch_array($rsgroup))
{
$producttype_idxx= $rowgroup["producttype_id"];
$product_typexx = $rowgroup["product_type"];
?>
<option value ="<? echo $producttype_idxx;?>"><?echo $product_typexx; ?></option>
<?

}
}



?>
</select>
</font></td>
</tr>
<tr bgcolor=#DBDBDB>
<td><font size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ยี่ห้อ :&nbsp;
<input name=brand type id="brand" text >
</font></td>
</tr>
<tr bgcolor=#DBDBDB>
<td ><font size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;รุ่น :&nbsp;
<INPUT NAME=sub_product TYPe id="sub_product" text ></font></td>
</tr>
<tr bgcolor=#DBDBDB>
<td><font size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;รายละเอียด :&nbsp;
<INPUT NAME=spec TYPe id="spec" text ></font></td>
</tr>
<tr bgcolor=#DBDBDB>
<td><font size=2>วันที่สั่งซื้อ :
<input name=date_buy type id="date_buy"></font></td>
</tr>
<tr bgcolor=#DBDBDB>
<td><font size=2>ข้อมูลร้านค้า :
<input name=store_data type id="store_data"></font></td>
</tr>
<tr bgcolor=#DBDBDB>
<td><font size=2>จำนวนใน Stock :&nbsp;
<INPUT NAME=stock TYPe id="stock" text >
&nbsp;ชิ้น</font></td>
</tr>
<tr bgcolor=#DBDBDB>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size=2>ไฟล์รูปภาพ :&nbsp;
<input type=file name=uploadfile>
</font></td>
</tr>
<tr>
<td><center>
<INPUT name="submit" TYPE="submit" value="Add">
</center></td>
</tr>
</table>
<p align="center">
<? //command add product data puts table product_stock
if(!empty($brand) && !empty($sub_product))
{
$rsconfig = mysql_query("select * from product order by product_id");
$x = mysql_num_rows($rsconfig);
if($x>0)
{
while($rowconfig = mysql_fetch_array($rsconfig))
{
$product_idx =$rowconfig["product_id"];
}
$product_idx++;
}else{
$product_idx=1;
}

if (isset($_FILES["uploadfile"]["name"]))
{
$uploaddir= "product/";
$uploadfile = $uploaddir.basename($_FILES['uploadfile']['name']);
// if(copy($uploadfile,$_FILES["uploadfile"]["name"]))
//{
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $uploadfile))
{
$path =$_FILES["uploadfile"]["name"]; // Pathfile\
}
mysql_query("insert into product values('$product_idx','$producttype_id','$sub_product','$spec','$brand','$date_buy','$store_data','$stock','$path','$showproduct')");
echo"<font color=blue>.....เพิ่มรายการพัสดุใหม่เรียบร้อยแล้ว.....</font>";
//}
}
}
?>
</p>
<p align="center"><a href="menuadmin.php"><<|Admin_Systems </a></p>
</form>
</td>


</tr>
</table>

<div align="center">
<table width="804" border="1" align="center" bordercolor="#CCCCCC">
<tr valign="top" bordercolor="#CCCCCC">
<td colspan="3" ><?php include("footer.htm"); ?></td>
</tr>
</table>
</div>

</body>
</html>

ข้างบน