|
 |
|
ช่วยด้วยครับ เรื่องการ Update ข้อมูลโดยระบุตามค่าที่รับ |
|
 |
|
|
 |
 |
|
Code (PHP)
if($_GET["Action"]=="Save")
{
$photo_tmp=$_FILES[photo][tmp_name];
$photo_name=$_FILES[photo][name];
$photo_type=$_FILES[photo][type];
$photo_size=$_FILES[photo][size];
if($photo_tmp==""){
echo "เลือกไฟล์ที่จะ upload....<hr>";
}else{
echo "Path Files : $photo_tmp<br>";
echo "Name : $photo_name<br>";
echo "Type : $photo_type<br>";
echo "Size : $photo_size";
echo "<hr>";
move_uploaded_file($photo_tmp,"./picture/slip/".$photo_name);
#เริ่มสร้างภาพขนาดเล็กหรือใหญ่ตามต้องการ
$ThumbPhoto="./picture/slip/";
$ThumbFile=$ThumbPhoto.$photo_name;
$ThumbH=10;
$Quality=100;
List($SourceW,$SourceH)=GetImageSize($ThumbFile);
$Percent=$ThumbH/$SourceH ;
$ThumbW=$SourceW*$Percent;
$ImgTarget=ImageCreateTrueColor($ThumbW,$ThumbH);
$ImgSource=ImageCreateFromJpeg($ThumbFile);
#ImageCopyResampled($ImgTarget,$ImgSource,0,0,0,0,$ThumbW,$ThumbH,$SourceW,$SourceH);
imagecopyresampled($ImgTarget,$ImgSource,0,0,0,0,$ThumbW,$ThumbH,$SourceW,$SourceH);
ImageDestroy($ImgTarget);
ImageDestroy($ImgSource);
$path="./picture/slip/";
//=========== อัพโหลตไฟล์เล็ก
@copy( $file ,"$path/$photo_name");
$sql_up = "update cusorder set image='$path''$photo_name'";
$dbquery_up = mysql_query($sql_up);
echo"<script language='JavaScript'>";
echo"alert('อัปโหลดเสร็จแล้ว..');";
echo"window.location='index.php'";
echo"</script>";
}
}
คือว่าจะให้มัน Update แค่เฉพาะ OrderNo ใน Database ชื่อ cusorder ที่ตรงกับกับค่าที่รับมาชื่อ $_GET[OrderNo] เท่านั้นอ่ะครับ
คือผมลองใส่เป็น $sql_up = "update cusorder set image='$path''$photo_name' where OrderNo = '$_GET[OrderNo]'"; ไปแล้วมันก็ไม่ Update เลยอ่ะครับ
ช่วยหน่อยนะครับ
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2011-04-06 11:11:50 |
By :
SteinKun |
View :
843 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แบบนี้มัน update ผ่านด้วยหรอครับโค๊ดที่เอามาแปะ update cusorder set image='$path''$photo_name'
ตรง set image='$path''$photo_name' ตัวแปร $path กับ $photo_name มันติดกันแบบนี้ได้เลยหรอครับ
ผมไม่รู้นะครับไม่เคยลอง ถ้าได้บอกด้วยนะครับ เป็นความรู้ของผมไปด้วย 
แต่ถ้าไม่ได้ลอง update cusorder set image= '".$path."'.'".$photo_name."' ดูนะครับ แต่ผมก็ไม่แน่ใจนะ
|
 |
 |
 |
 |
Date :
2011-04-06 12:37:31 |
By :
bank32 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือว่าอัพเดทเข้าครับ จริง ๆ ที่กล่าวมาข้างบนเป็นการเซฟพาทรูปอ่ะครับ แต่ตอนมันอัพเดทข้อมูล image ทั้ง Database เลยครับ คือผมอยากจะให้มีการระบุเช่น ใส่ค่า ORDER-000011 แล้วระบบจะทำการอัพเดทข้อมูลใน Database ที่มีค่า OrderNo ที่มีค่าเท่ากับ ORDER-000011 อ่ะครับ
|
 |
 |
 |
 |
Date :
2011-04-06 14:19:40 |
By :
SteinKun |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใส่ค่า ORDER-000011 แล้วระบบจะทำการอัพเดทข้อมูลใน Database ที่มีค่า OrderNo ที่มีค่าเท่ากับ ORDER-000011 อ่ะครับ
ผมงงประโยคนี้อะครับ หมายถึงใส่ ORDER-xxxx เท่าไร แล้วไป update ใน db field OrderNo หรือเปล่าครับ ถ้ายังงั้นผมพอมองออกแล้ว แต่ถ้าไม่ใช่อธิบายให้ชัดๆกว่านี้ทีครับ
|
ประวัติการแก้ไข 2011-04-06 20:30:33
 |
 |
 |
 |
Date :
2011-04-06 20:29:49 |
By :
bank32 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|