|
|
|
อัพเดทรูปภาพลงในฐานข้อมูลไม่ได้คับ Mysql ต้องใส่ insert เข้าไปตอนอัพเดทตรงไหนคับ |
|
|
|
|
|
|
|
Code (PHP)
<?
include('config.inc.php');
$strSQL = "UPDATE files SET ";
$strSQL .="Name = '".$_POST["txtName"]."' ";
$strSQL .="WHERE FilesID = '".$_GET["FilesID"]."' ";
$objQuery = mysql_query($strSQL);
if($_FILES["filUpload"]["name"] != "")
{
if(copy($_FILES["filUpload"]["tmp_name"],"manu1_2/".$_FILES["filUpload"]["name"]))
{
//*** Delete Old File ***//
@unlink("manu1_2/".$_POST["hdnOldFile"]);
//*** Update New File ***//
$strSQL = "UPDATE files SET ";
$strSQL .="picture = '".$_FILES["filUpload"]["name"]."' ";
$strSQL .="WHERE FilesID = '".$_GET["FilesID"]."' ";
$objQuery = mysql_query($strSQL);
echo "Copy/Upload Complete<br>";
}
}
mysql_close();
?>
ไม่ได้เลยคับ ดาต้าเบส ผมมี FilesID,Name,picture
|
|
|
|
|
Date :
2012-12-21 13:06:15 |
By :
woraman |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<form action="edit2.php?FilesID=<?=$_GET["FilesID"];?>" name="frmEdit" method="post">
<?
include('config.inc.php');
$strSQL = "SELECT * FROM files WHERE FilesID = '".$_GET["FilesID"]."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not found FilesID=".$_GET["FilesID"];
}
else
{
?>
<table width="1260" height="845" border="2">
<tr>
<td height="81" colspan="3"><? include"b.php" ?>
</td>
</tr>
<tr>
<td width="186" height="683" valign="top"><? include"c.php" ?></td>
<td width="857" colspan="2" valign="top" align="center"><br><table width="600" border="1">
<tr>
<th width="91"> <div align="center">FilesID </div></th>
<th width="160"> <div align="center">Name </div></th>
<th width="198"> <div align="center">picture </div></th>
</tr>
<tr>
<td><div align="center"><input type="text" name="txtFilesID" size="5" value="<?=$objResult["FilesID"];?>"></div></td>
<td><input type="text" name="txtName" size="20" value="<?=$objResult["Name"];?>"></td>
<td><input type="file" name="filUpload"></td>
<input type="hidden" name="hdnOldFile" value="<?=$objResult["picture"];?>">
</tr>
</table><br><br><input type="submit" name="submit" value="submit"></td>
</tr>
<tr>
<td colspan="3"><? include"d.php" ?></td>
</tr>
</table>
<?
}
mysql_close();
?>
****** อันนี้หน้าก่อนของอันข้างบนคับ *******
|
|
|
|
|
Date :
2012-12-21 13:07:44 |
By :
woraman |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วตอน insert รูปภาพได้ปกติไหมครับ
|
|
|
|
|
Date :
2012-12-21 16:40:13 |
By :
backship |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|