|
 |
|
รูปมัน Resize เก็บเข้า Folder แต่มันมันยอมเก็ยข้อมูลเข้าฐานข้อมูลอ่ะครับ |
|
 |
|
|
 |
 |
|
Code (PHP)
<?
echo"<script type=text/javascript language=JavaScript1.2 src=popup.js></script>";
$folderpic = "images" ;
$max_size = 1000;
$width=500;
$height=300;
$file_size=$_FILES['file']['size'];
$limit_size=1000*$max_size;
if($file_size >= $limit_size){
echo "<script language='javascript'>alert('ไฟล์ของคุณใหญ่เกินไปครับต้องมีขนาดไม่เกิน $max_size kb');</script>";
} else {
if($_FILES["file"]["tmp_name"]){
$fileUpload=$_FILES["file"]["tmp_name"];
$fileUpload_name=$_FILES["file"]["name"];
//*** Delete Old File ***//
@unlink("images/".$_POST["hdnOldFile"]);
if (isset($_FILES["file"]["name"])) {
$ext = strtolower(end(explode('.', $fileUpload_name)));
$dateUpFile=date("YmdHis");
$newname=$dateUpFile.".".$ext;
$images = $fileUpload;
$size = getimagesize($images);
$img_type=strtolower(end(explode('.',$images)));
if($size[2] == 1) {
$images_orig = imagecreatefromgif($images);
} else if($size[2] == 2) {
$images_orig = imagecreatefromjpeg($images);
}
else if($size[2] == 3) {
$images_orig = imagecreatefrompng($images);
}
$photoX = imagesx($images_orig);
$photoY = imagesy($images_orig);
$images_fin = imagecreatetruecolor($width, $height);
imagecopyresampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
imagejpeg($images_fin,"$folderpic/".$newname);
imagedestroy($images_orig);
imagedestroy($images_fin);
}
}
}
include "connect.php";
if($firstname=="" || $lastname=="" ){
echo"<center><font color=red>อัพเดทข้อมูลไม่สำเร็จ เนื่องจากกรอกข้อมูลไม่ครบ</font><br>";
echo"<a href=javascript:history.back();>กลับไปแก้ไข</a></center>";
}else{
$SQL_update_member="update tb_user set file='$newname',type='$type',sex='$sex',firstname='$firstname',lastname='$lastname',idstudent='$idstudent',level='$level',clas='$clas',room='$room',mejor='$mejor', numcar='$numcar',jungwud='$jungwud',brand='$brand',model='$model',color='$color',numcar2='$numcar2',regiscar='$regiscar',vol='$vol',day='$day', month='$month',year='$year', day2='$day2',month2='$month2',year2='$year2',numhome='$numhome',village='$village',soi='$soi', road='$road',district='$district',border='$border',province='$province',post='$post',hphone='$hphone', sphone='$sphone',fname='$fname',flastname='$flastname',fphone='$fphone',mname2='$mname2',mlastname2='$mlastname2',mphone2='$mphone2' where id = '$id'";
$dbquery =mysql_db_query($db_name,$SQL_update_member);
echo"<center><br><br><br><font color=red>อัพเดทข้อมูลเรียบร้อยแล้วครับ</font><br><br><br>";
echo"<input type=button value=ปิดหน้านี้ onclick=javascript:window.reloadopener();></center>";
mysql_close();
}
?>
มันไม่ยอมเก็บอะไรเข้าฐานข้อมูลเลยอ่ะครับ
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2011-09-20 00:24:48 |
By :
labutus |
View :
721 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
if(!$dbquery){
echo mysql_error();
}
else{
echo "บันทึกข้อมูล";
}
เอาไปเช็คดูครับว่ามันแจ้ง error ว่าอะไร จะได้รู้ครับ
|
ประวัติการแก้ไข 2011-09-20 01:40:05
 |
 |
 |
 |
Date :
2011-09-20 01:39:41 |
By :
lootboom |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$db_name อยู่ไหน แล้วไป connect database ตอนไหนครับ
|
 |
 |
 |
 |
Date :
2011-09-20 02:51:45 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองทำตามคำแนะนำของ 2 ท่านแล้วครับ
ได้แล้วครับขอบคุณมากเลยครับ
|
 |
 |
 |
 |
Date :
2011-09-20 17:43:48 |
By :
labutus |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|