|
|
|
รบกวนถามเรื่องการอัพโหลดรูปคะ คือ การอัพโหลดรูปทีละหลายๆๆรูป แล้วเราจะแก้ไขรูปยังไง |
|
|
|
|
|
|
|
เอาโค๊ดมาดูครับ
|
|
|
|
|
Date :
2011-03-15 12:33:39 |
By :
PlaKriM |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
หน้ารับข้อมูล
Code (PHP)
<html><style type="text/css">
<!--
body {
background-color: #FFCCFF;
}
.style1 {color: #0000FF}
.style3 {color: #0000FF; font-weight: bold; }
-->
</style>
<BODY>
<table width="78%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td width="19%"></td>
<td width="81%" valign="top" >
<?
$id_work=$_GET["id_work"];
include("connection.php");
// $sql="select * from work_s,files where files.id_work = work_s.id_work ";
$sql="SELECT id_work,name_work,date_work,detail_work,day_work,id_en from work_s where id_work ='$id_work' ";
$result = mysql_query($sql);
while($row=mysql_fetch_assoc($result))
{
$id_work=$row["id_work"];
$name_work=$row["name_work"];
$date_work=$row["date_work"];
$detail_work=$row["detail_work"];
$day_work=$row["day_work"];
$id_en=$row["id_en"];
$file=$row["fileupload"];
}
?>
<?
//$id_work=$_GET["id_work"];
include("connection.php");
// $sql="select * from work_s,files where files.id_work = work_s.id_work ";
$sql3="SELECT FilesName from files where FilesName ='$name' ";
$result3 = mysql_query($sql);
while($row=mysql_fetch_assoc($result))
{
$file=$row["name"];
}
?>
<FORM ACTION="editwork2.php" METHOD="post" ENCTYPE="multipart/form-data" Name="frmMain" id="frmMain">
<table align="center" width="60%" border="1">
<tr>
<td bgcolor="#CCFF66"><span class="style3">รหัส</span></td>
<td bgcolor="#CCFF66"><span class="style3">
<input name="id_work" type="hidden" id="id_work" value="<?echo "$id_work";?>">
<? echo "$id_work";?></span></td>
</tr>
<tr>
<td bgcolor="#CCFF66"> </td>
<td bgcolor="#CCFF66"> </td>
</tr>
<tr>
<td bgcolor="#CCFF66"><span class="style3">ชื่อ</span></td>
<td bgcolor="#CCFF66"><input name="name_work" type="text" id="name_work" value="<?echo "$name_work";?>"></td>
</tr>
<tr>
<td bgcolor="#CCFF66">วัน</td>
<td bgcolor="#CCFF66"><input name="date_work" type="text" id="date_work" value="<?echo "$date_work";?>"></td>
</tr>
<tr>
<td bgcolor="#CCFF66">รายละเอียด</td>
<td bgcolor="#CCFF66"><input name="detail_work" type="text" id="detail_work" value="<?echo "$detail_work";?>"></td>
</tr>
<tr>
<td bgcolor="#CCFF66"><span class="style3">วัน</span></td>
<td bgcolor="#CCFF66"><input name="day_work" type="text" id="day_work "value="<?echo "$day_work";?>"></td>
</tr>
<tr>
<td bgcolor="#CCFF66">รหัสวิศวกร</td>
<td><input name="id_en" type="text" id="id_en "value="<?echo "$id_en";?>"></td>
<tr>
<td bgcolor="#CCFF66">รูปภาพ</td>
<td><INPUT TYPE="file" NAME="filUpload[]" ></td>
<tr>
<td align="center" colspan="2"><br><INPUT TYPE="submit" VALUE="ตกลง">
<br><br></td>
</tr>
</table>
</FORM>
</BODY>
</HTML>
หน้าแสดงข้อมูล
Code (PHP)
<style type="text/css">
<!--
body {
background-color: #99FFCC;
}
-->
</style><BODY>
<table width="78%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td width="19%"></td>
<td width="81%" valign="top" bgcolor="#CCFFFF">
<?
include("connection.php");
$id_work=$_POST['id_work'];
$name_work=$_POST['name_work'];
$date_work=$_POST['date_work'];
$detail_work=$_POST['detail_work'];
$day_work=$_POST['day_work'];
$id_en=$_POST['id_en'];
$file=$_POST["filUpload"];
//$file=$_POST["fileupload"];
/**$sql="update work set `id_work`='$id_work' ,`name_work`='$name_work',`date_work`='$date_work',`detail_work`='$detail_work',`day_work`='$day_work'
,`image`='$image' where `id_work` = '$id_work' ";
$result = mysql_query($sql);
echo "<center>Updateข้อมูล เรียบร้อยแล้ว</center> ";
**/
include "connection.php";
if ($chkdel=="1") {
$sql3="update files set FilesName='$name' where id_work ='$id_work' ";
$result3=mysql_db_query($dbname,$sql3);
unlink("myfile/$image_del");
}
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") {
$imagename=$name.".".$lastname;
copy($filUpload,"myfile/".$imagename);
$sql3="update files set FilesName='$name' where FilesName ='$name' ";
$result3=mysql_db_query($dbname,$sql3);
}
unlink($filUpload);
}
$sql="update work_s set
id_work='$id_work',
date_work='$date_work',
name_work='$name_work',
detail_work='$detail_work',
id_en='$id_en',
day_work='$day_work' where id_work='$id_work' ";
$result=mysql_db_query($dbname,$sql);
if ($result) {
echo "<H3>บันทึกข้อมูลลงฐานข้อมูลเรียบร้อยแล้วคะ</H3>";
echo "[ <A HREF=showdetail.php>กลับหน้าแสดงข้อมูล</A> ] ";
} else {
echo "<H3>ERROR : ไม่สามารถบันทึกข้อมูลได้คะ</H3>";
}
mysql_close();
?>
<meta http-equiv="refresh" content="2;url=showdetail.php" >
</BODY>
</HTML>
|
|
|
|
|
Date :
2011-03-15 12:47:53 |
By :
blooka |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ช่วยดูให้หน่อยคะ
|
|
|
|
|
Date :
2011-03-15 20:47:42 |
By :
blooka |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ปกติที่ผมทำ ถ้าเป็นรูป ลบทิ้ง แล้วอับไหม่ครับ
ส่วน ที่เป็น งาน แก็แก้ไขปกติ เหมือนเราแก้ไขข้อมูลทั่วไปครับ
|
|
|
|
|
Date :
2011-03-15 21:08:47 |
By :
tingtongkub |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วพอจะแก้ไขได้มั้ยอ่ะคะ
ฮือๆๆๆๆๆๆๆๆๆๆๆๆๆ
คือทำโปรเจค ยุ อ่ะคะ
|
ประวัติการแก้ไข 2011-03-15 22:02:50
|
|
|
|
Date :
2011-03-15 21:11:33 |
By :
blooka |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|