Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > UPDATE รูป แล้วไม่ลงฐานข้อมูลจะต้องทำยังไงครับรบกวนพี่ๆช่วยดูให้หน่อยครับ



 

UPDATE รูป แล้วไม่ลงฐานข้อมูลจะต้องทำยังไงครับรบกวนพี่ๆช่วยดูให้หน่อยครับ

 



Topic : 073966



โพสกระทู้ ( 8 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook



from_update

คือว่าผมจะแก้ไขข้อมูลของสินค้าจะกดลิ้งค์แก้ไขจากหน้าสินค้า แล้วก็จะมาฟอร์มอัพเดทนี้ครับ เวลาผมป้อนข้อมูลที่จะแก้ไขมันสามารถลงฐานข้อมูลได้หมดยกเว้นรูปภาพมันไม่เข้าไปที่ฐานข้อมูลครับ เลยจะขอรบกวนพี่ๆช่วยดูให้หน่อยครับ

DB


code file:admin_product_edit.php

Code (PHP)
<?
session_start();
if ($sess_adminid<>session_id()) { 
	header( "Location: admin_index.php"); exit(); 
}
$Edit_id=$_GET[Edit_id];
include "connect.php";
$sql2="select * from products where Pro_id='$Edit_id' ";
mysql_query("SET NAMES utf8");
$result2=mysql_db_query($dbname,$sql2);
$rs=mysql_fetch_array($result2);

$Pro_id=$rs[Pro_id];
$code=sprintf("%05d",$Pro_id);
$Proname=$rs[Proname];
$pro_type_id=$rs[pro_type_id];
$pro_brand_id=$rs[pro_brand_id];
$Description=$rs[Description];
$Total=$rs[Total];
$Price=$rs[Price];
$pro_image=$rs[pro_image];
?>
<!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>
<script>
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-image: url();
	background-repeat: no-repeat;
}
.style3 {color: #FFFFFF}
a:link {
	color: #0000FF;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #0000FF;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.style4 {color: #FF0000}
-->
</style>
<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {color: #FF0000}
-->
</style></head>
<body>
<form id="form1" name="form1" method="post" action="admin_product_edit2.php">
  <div align="center">
    <table width="1218" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td height="235" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="312" height="234" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <tr>
                <td height="234" colspan="2" valign="top"><img src="image/logo_zz.jpg" width="347" height="234" /></td>
                  </tr>
              <tr>
                <td width="315" height="1"></td>
                    <td width="315"></td>
                  </tr>
              </table></td>
              <td width="769" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                <!--DWLayoutTable-->
                <tr>
                  <td width="773" height="235" valign="top"><img src="image/bgweb2.jpg" width="903" height="234" /></td>
                  </tr>
              </table></td>
            </tr>
        </table></td>
        <td width="1"></td>
      </tr>
      <tr>
        <td height="36" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="1217" height="36" valign="top" bgcolor="#000000"><!--DWLayoutEmptyCell-->&nbsp;</td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td width="250" rowspan="7" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="250" height="460" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            </tr>
        </table></td>
        <td width="770" height="37" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="770" height="37" align="center" valign="middle"><div align="center">             </td>
          </tr>     
        </table></td>
        <td width="197" rowspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="197" height="180" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
          </tr>
          <tr>
            <td height="3"></td>
            </tr>
          
        </table></td>
        <td></td>
      </tr>
      <tr>
        <td height="161" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="770" height="112" valign="top">
              <?  include "admin_head.php"; ?>			&nbsp;</td>
              </tr>
          <tr>
            <td height="1"></td>
            </tr>
        </table></td>
        <td></td>
      </tr>
      <tr>
        <td rowspan="6" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="770" height="319" align="center" valign="top">
            <p><b>ข้อมูลสินค้า</b></p>
            <TABLE WIDTH="437" BORDER="0" CELLSPACING="1" CELLPADDING="0">
    <TR>
      <TD align="right" valign="top">รหัสสินค้า</TD>
      <TD width="316" align="left" valign="top"><?=$code?></TD>
    </TR>
    <TR>
      <TD width="118" align="right" valign="top">ชื่อสินค้า</TD>
      <TD align="left" valign="top"><INPUT TYPE="text" NAME="Proname" SIZE="40" VALUE="<?=$Proname?>">
        <span class="style1">*</span> </TD>
    </TR>
    <TR>
      <TD align="right" valign="top">ประเภทสินค้า</TD>
      <TD align="left" valign="top">
	  <SELECT NAME="pro_type_id">
	  <?
		$sql2="select * from type";
		$result2=mysql_db_query($dbname,$sql2);
	  	while($rs2=mysql_fetch_array($result2)) {
			$Type_id=$rs2[Type_id];
			$Type_name=$rs2[Type_name];
			if ($pro_type_id==$Type_id) {
				echo "<OPTION VALUE='$Type_id' SELECTED>$Type_name</OPTION>";
			} else {
				echo "<OPTION VALUE='$Type_id' >$Type_name</OPTION>";
			}
		}
	  ?>
      </SELECT></TD>
    </TR>
    <TR>
      <TD width="118" align="right" valign="top">ยี่ห้อ</TD>
      <TD align="left" valign="top"><SELECT NAME="pro_brand_id">
	  <?
		$sql4="select * from brand";
		$result4=mysql_db_query($dbname,$sql4);
	  	while($rs3=mysql_fetch_array($result4)) {
			$brand_id=$rs3[brand_id];
			$brandname=$rs3[brandname];
			if ($pro_brand_id==$brand_id) {
				echo "<OPTION VALUE='$brand_id' SELECTED>$brandname</OPTION>";
			} else {
				echo "<OPTION VALUE='$brand_id' >$brand_name</OPTION>";
			}
		}
	  ?>
      </SELECT>
        <span class="style1">*</span> </TD>
    </TR>
    <TR>
      <TD align="right" valign="top">รายละเอียด</TD>
      <TD align="left" valign="top"><TEXTAREA NAME="Description" COLS="40" ROWS="4"><?=$Description?></TEXTAREA> <span class="style1">*</span> </TD>
    </TR>
    <TR>
      <TD width="118" align="right" valign="top">จำนวน</TD>
      <TD align="left" valign="top"><INPUT NAME="Total" TYPE="text" id="Total" VALUE="<?=$Total?>" SIZE="40">
        <span class="style1">*</span> </TD>
    </TR>
    <TR>
      <TD align="right" valign="top">ราคา</TD>
      <TD align="left" valign="top"><INPUT  TYPE="text" NAME="Price" SIZE="20" VALUE="<?=$Price?>">
      บาท <span class="style1">*</span></TD>
    </TR>
    <TR>
      <TD align="right" valign="top">รูปภาพ</TD>
      <TD align="left">
      <?
      	if ($pro_image<>"") {
		echo"<input type='checkbox'  name='chkdel' value='1'> ลบรูปภาพ<br>";
		echo"<a href='image/$pro_image' target='_blank'>แสดงรูปภาพ</a>";	
		}   else {
		echo "<INPUT TYPE='file' NAME='fileupload' >";
		echo "<INPUT TYPE='hidden' name='MAX_FILE_SIZE' value='100000'>";
		}
	  ?>   
    </TR>
    <TR>
      <TD align="right" valign="top">&nbsp;</TD>
      <TD align="left" valign="top">
		<INPUT TYPE="submit" NAME="Submit" VALUE="Submit">
        <INPUT TYPE="reset" NAME="Submit2" VALUE="Reset">
        <INPUT NAME="Edit_id" TYPE="hidden"  VALUE="<?=$Edit_id?>">
        <INPUT NAME="photo_del" TYPE="hidden"  VALUE="<?=$pro_image?>">		</TD>
    </TR>
  </TABLE>  </td>
            </tr> 
        </table></td>
        <td height="33"></td>
      </tr>
      <tr>
        <td height="36">&nbsp;</td>
        <td></td>
      </tr>
      <tr>
        <td height="137" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="197" height="137" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            </tr>
        </table></td>
        <td></td>
      </tr>
      <tr>
        <td height="36">&nbsp;</td>
        <td></td>
      </tr>
      <tr>
        <td rowspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="197" height="137" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            </tr>
        </table></td>
        <td height="20"></td>
      </tr>
      <tr>
        <td height="164">&nbsp;</td>
        <td></td>
      </tr>
      <tr>
        <td height="42">&nbsp;</td>
        <td><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td></td>
      </tr>
      <tr>
        <td height="262">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td></td>
      </tr>
      <tr>
        <td height="47" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="1217" height="47" valign="top"><div align="center"><img src="image/logolow.jpg" width="934" height="47" /></div></td>
            </tr>
        </table></td>
        <td></td>
      </tr>
      <tr>
        <td height="521">&nbsp;</td>
        <td></td>
        <td>&nbsp;</td>
        <td></td>
      </tr>
    </table>
  </div>
</form>
</body>
</html>


code file:admin_product_edit2.php

Code (PHP)
<?
session_start();
if ($sess_adminid<>session_id()) { 
	header( "Location: admin_index.php"); exit(); 
}
$Edit_it=$_POST[Edit_id];
$proname=$_POST[proname];
$pro_type_id=$_POST[pro_type_id];
$pro_brand_id=$_POST[pro_brand_id];
$Description=$_POST[Description];
$Total=$_POST[Total];
$Price=$_POST[Price];

$fileupload=$_FILES['fileupload']['tmp_name'];
$fileupload_name=$_FILES['fileupload']['name'];
$fileupload_size=$_FILES['fileupload']['size'];
$fileupload_type=$_FILES['fileupload']['type'];
include "connect.php";
if ($fileupload) {
	$array_last=explode(".",$fileupload_name);
	$c=count($array_last)-1; 
	$lastname=strtolower($array_last[$c]) ;
	
	if ($lastname=="gif" or $lastname=="jpg" or $lastname=="jpeg") {
		$photoname=$Edit_it.".".$lastname;
		copy($fileupload,"image/".$photoname);
	
		$sqlup="update products set pro_image='$photoname' where Pro_id ='$Edit_id' ";
		mysql_query("SET NAME utf8");
		$resultup=mysql_db_query($dbname,$sqlup);
	} 
	unlink($fileupload);
} 
			$sql="update products set  
			Proname='$Proname',
			pro_type_id='$pro_type_id',
			pro_brand_id='$pro_brand_id',
			Description='$Description',
			Total='$Total',
			Price='$Price' where Pro_id='$Edit_it' ";
			mysql_query("SET NAME utf8");
			$result=mysql_db_query($dbname,$sql);
if ($chkdel=="1") {
		$sqldel="update products set pro_image='' where Pro_id ='$Edit_id' ";
		$resultdel=mysql_db_query($dbname,$sqldel);
		mysql_query("SET NAME utf8");
		unlink("image/$photo_del");
}
if ($result) {
	echo "<H3>Revised Succesful</H3>";
	echo "[ <A HREF=admin_product.php>Back To Home</A> ] ";
} else {
	echo "<H3>ERROR : Not Rrevised </H3>";
	echo "[ <A HREF=admin_home.php>Back To Home</A> ] ";
}
mysql_close();
?>




Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-02-16 15:43:50 By : bal6225 View : 966 Reply : 4
 

 

No. 1



โพสกระทู้ ( 616 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Facebook

ขอแก้รูปแบบการแสดงนะครับ

Code (PHP)
code file:admin_product_edit.php
<?
session_start();
if ($sess_adminid<>session_id()) {
header( "Location: admin_index.php"); exit();
}
$Edit_id=$_GET[Edit_id];
include "connect.php";
$sql2="select * from products where Pro_id='$Edit_id' ";
mysql_query("SET NAMES utf8");
$result2=mysql_db_query($dbname,$sql2);
$rs=mysql_fetch_array($result2);

$Pro_id=$rs[Pro_id];
$code=sprintf("%05d",$Pro_id);
$Proname=$rs[Proname];
$pro_type_id=$rs[pro_type_id];
$pro_brand_id=$rs[pro_brand_id];
$Description=$rs[Description];
$Total=$rs[Total];
$Price=$rs[Price];
$pro_image=$rs[pro_image];
?>
<!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>
<script>
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url();
background-repeat: no-repeat;
}
.style3 {color: #FFFFFF}
a:link {
color: #0000FF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #0000FF;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.style4 {color: #FF0000}
-->
</style>
<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style1 {color: #FF0000}
-->
</style></head>
<body>
<form id="form1" name="form1" method="post" action="admin_product_edit2.php">
<div align="center">
<table width="1218" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="235" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="312" height="234" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="234" colspan="2" valign="top"><img src="image/logo_zz.jpg" width="347" height="234" /></td>
</tr>
<tr>
<td width="315" height="1"></td>
<td width="315"></td>
</tr>
</table></td>
<td width="769" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="773" height="235" valign="top"><img src="image/bgweb2.jpg" width="903" height="234" /></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="1"></td>
</tr>
<tr>
<td height="36" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1217" height="36" valign="top" bgcolor="#000000"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td width="250" rowspan="7" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="250" height="460" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
</table></td>
<td width="770" height="37" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="770" height="37" align="center" valign="middle"><div align="center"> </td>
</tr>
</table></td>
<td width="197" rowspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="197" height="180" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
<tr>
<td height="3"></td>
</tr>

</table></td>
<td></td>
</tr>
<tr>
<td height="161" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="770" height="112" valign="top">
<? include "admin_head.php"; ?> &nbsp;</td>
</tr>
<tr>
<td height="1"></td>
</tr>
</table></td>
<td></td>
</tr>
<tr>
<td rowspan="6" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="770" height="319" align="center" valign="top">
<p><b>ข้อมูลสินค้า</b></p>
<TABLE WIDTH="437" BORDER="0" CELLSPACING="1" CELLPADDING="0">
<TR>
<TD align="right" valign="top">รหัสสินค้า</TD>
<TD width="316" align="left" valign="top"><?=$code?></TD>
</TR>
<TR>
<TD width="118" align="right" valign="top">ชื่อสินค้า</TD>
<TD align="left" valign="top"><INPUT TYPE="text" NAME="Proname" SIZE="40" VALUE="<?=$Proname?>">
<span class="style1">*</span> </TD>
</TR>
<TR>
<TD align="right" valign="top">ประเภทสินค้า</TD>
<TD align="left" valign="top">
<SELECT NAME="pro_type_id">
<?
$sql2="select * from type";
$result2=mysql_db_query($dbname,$sql2);
while($rs2=mysql_fetch_array($result2)) {
$Type_id=$rs2[Type_id];
$Type_name=$rs2[Type_name];
if ($pro_type_id==$Type_id) {
echo "<OPTION VALUE='$Type_id' SELECTED>$Type_name</OPTION>";
} else {
echo "<OPTION VALUE='$Type_id' >$Type_name</OPTION>";
}
}
?>
</SELECT></TD>
</TR>
<TR>
<TD width="118" align="right" valign="top">ยี่ห้อ</TD>
<TD align="left" valign="top"><SELECT NAME="pro_brand_id">
<?
$sql4="select * from brand";
$result4=mysql_db_query($dbname,$sql4);
while($rs3=mysql_fetch_array($result4)) {
$brand_id=$rs3[brand_id];
$brandname=$rs3[brandname];
if ($pro_brand_id==$brand_id) {
echo "<OPTION VALUE='$brand_id' SELECTED>$brandname</OPTION>";
} else {
echo "<OPTION VALUE='$brand_id' >$brand_name</OPTION>";
}
}
?>
</SELECT>
<span class="style1">*</span> </TD>
</TR>
<TR>
<TD align="right" valign="top">รายละเอียด</TD>
<TD align="left" valign="top"><TEXTAREA NAME="Description" COLS="40" ROWS="4"><?=$Description?></TEXTAREA> <span class="style1">*</span> </TD>
</TR>
<TR>
<TD width="118" align="right" valign="top">จำนวน</TD>
<TD align="left" valign="top"><INPUT NAME="Total" TYPE="text" id="Total" VALUE="<?=$Total?>" SIZE="40">
<span class="style1">*</span> </TD>
</TR>
<TR>
<TD align="right" valign="top">ราคา</TD>
<TD align="left" valign="top"><INPUT TYPE="text" NAME="Price" SIZE="20" VALUE="<?=$Price?>">
บาท <span class="style1">*</span></TD>
</TR>
<TR>
<TD align="right" valign="top">รูปภาพ</TD>
<TD align="left">
<?
if ($pro_image<>"") {
echo"<input type='checkbox' name='chkdel' value='1'> ลบรูปภาพ<br>";
echo"<a href='image/$pro_image' target='_blank'>แสดงรูปภาพ</a>";
} else {
echo "<INPUT TYPE='file' NAME='fileupload' >";
echo "<INPUT TYPE='hidden' name='MAX_FILE_SIZE' value='100000'>";
}
?>
</TR>
<TR>
<TD align="right" valign="top">&nbsp;</TD>
<TD align="left" valign="top">
<INPUT TYPE="submit" NAME="Submit" VALUE="Submit">
<INPUT TYPE="reset" NAME="Submit2" VALUE="Reset">
<INPUT NAME="Edit_id" TYPE="hidden" VALUE="<?=$Edit_id?>">
<INPUT NAME="photo_del" TYPE="hidden" VALUE="<?=$pro_image?>"> </TD>
</TR>
</TABLE> </td>
</tr>
</table></td>
<td height="33"></td>
</tr>
<tr>
<td height="36">&nbsp;</td>
<td></td>
</tr>
<tr>
<td height="137" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="197" height="137" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
</table></td>
<td></td>
</tr>
<tr>
<td height="36">&nbsp;</td>
<td></td>
</tr>
<tr>
<td rowspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="197" height="137" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
</table></td>
<td height="20"></td>
</tr>
<tr>
<td height="164">&nbsp;</td>
<td></td>
</tr>
<tr>
<td height="42">&nbsp;</td>
<td><!--DWLayoutEmptyCell-->&nbsp;</td>
<td></td>
</tr>
<tr>
<td height="262">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
</tr>
<tr>
<td height="47" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1217" height="47" valign="top"><div align="center"><img src="image/logolow.jpg" width="934" height="47" /></div></td>
</tr>
</table></td>
<td></td>
</tr>
<tr>
<td height="521">&nbsp;</td>
<td></td>
<td>&nbsp;</td>
<td></td>
</tr>
</table>
</div>
</form>
</body>
</html>
***********************************************************************************************************************************************************
code file:admin_product_edit2.php
<?
session_start();
if ($sess_adminid<>session_id()) {
header( "Location: admin_index.php"); exit();
}
$Edit_it=$_POST[Edit_id];
$proname=$_POST[proname];
$pro_type_id=$_POST[pro_type_id];
$pro_brand_id=$_POST[pro_brand_id];
$Description=$_POST[Description];
$Total=$_POST[Total];
$Price=$_POST[Price];

$fileupload=$_FILES['fileupload']['tmp_name'];
$fileupload_name=$_FILES['fileupload']['name'];
$fileupload_size=$_FILES['fileupload']['size'];
$fileupload_type=$_FILES['fileupload']['type'];
include "connect.php";
if ($fileupload) {
$array_last=explode(".",$fileupload_name);
$c=count($array_last)-1;
$lastname=strtolower($array_last[$c]) ;

if ($lastname=="gif" or $lastname=="jpg" or $lastname=="jpeg") {
$photoname=$Edit_it.".".$lastname;
copy($fileupload,"image/".$photoname);

$sqlup="update products set pro_image='$photoname' where Pro_id ='$Edit_id' ";
mysql_query("SET NAME utf8");
$resultup=mysql_db_query($dbname,$sqlup);
}
unlink($fileupload);
}
$sql="update products set
Proname='$Proname',
pro_type_id='$pro_type_id',
pro_brand_id='$pro_brand_id',
Description='$Description',
Total='$Total',
Price='$Price' where Pro_id='$Edit_it' ";
mysql_query("SET NAME utf8");
$result=mysql_db_query($dbname,$sql);
if ($chkdel=="1") {
$sqldel="update products set pro_image='' where Pro_id ='$Edit_id' ";
$resultdel=mysql_db_query($dbname,$sqldel);
mysql_query("SET NAME utf8");
unlink("image/$photo_del");
}
if ($result) {
echo "<H3>Revised Succesful</H3>";
echo "[ <A HREF=admin_product.php>Back To Home</A> ] ";
} else {
echo "<H3>ERROR : Not Rrevised </H3>";
echo "[ <A HREF=admin_home.php>Back To Home</A> ] ";
}
mysql_close();
?>







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-02-16 15:53:06 By : slurpee55555
 


 

No. 2



โพสกระทู้ ( 616 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Facebook

มี error ปะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-02-16 15:54:19 By : slurpee55555
 

 

No. 3



โพสกระทู้ ( 8 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ตอบความคิดเห็นที่ : 2 เขียนโดย : slurpee55555 เมื่อวันที่ 2012-02-16 15:54:19
รายละเอียดของการตอบ ::
ไม่errorครับ แต่ไฟล์รูปไม่ลง DBเหมือนเดิมครับ มันติดตรงไหนก็ไม่รู้อ่ะครับผมงมมาหลายวันและ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-02-16 16:02:43 By : bal6225
 


 

No. 4



โพสกระทู้ ( 3,748 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์
Facebook

ไม่ได้ดูไฟล์นะ echo ชื่อรูปที่ยัดเข้า db ออกมาดูครับว่ามีชื่อไปหรือเปล่า ถ้ามีก็ พาร์ทผิดครับ ถ้าไม่ผิดก็ cmod 777
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-02-16 17:02:11 By : Dragons_first
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : UPDATE รูป แล้วไม่ลงฐานข้อมูลจะต้องทำยังไงครับรบกวนพี่ๆช่วยดูให้หน่อยครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่