|
 |
|
สอบถามเรื่อง UPDATE ภาพ ในในหน้า edit ข้อมูลสมาชิกของระบบสมาชิก ครับ |
|
 |
|
|
 |
 |
|
อยากจะทราบเกี่ยว กับการ update หภาพโปรไฟล์ ทำแล้วไม่ไม่สามารถอัพเดท ภาพได้ครับ รบกวน เชคโค้ดผมหน่อยครับ
Code (PHP)
$id_edit=$_POST[id_edit];
$name=trim($_POST['name']);
$nickname=trim($_POST['nickname']);
$gender=$_POST['gender'];
$email=trim($_POST['email']);
$office=trim($_POST['office']);
$position=trim($_POST['position']);
$date=trim($_POST['date']);
$month=trim($_POST['month']);
$year=trim($_POST['year']);
$address=trim($_POST['address']);
$province=trim($_POST['province']);
$zipcode=trim($_POST['zipcode']);
$phone=trim($_POST['phone']);
date_default_timezone_set('Asia/Bangkok');
$timenow = date("Y-m-d H:i:s");
$datepic = date("Ymd_siH");
$ip= $REMOTE_ADDR;
$birthdate = $year."-".$month."-".$date;
$fileupload=$_FILES['fileupload']['tmp_name'];
$fileupload_name=$_FILES['fileupload']['name'];
$fileupload_size=$_FILES['fileupload']['size'];
$fileupload_type=$_FILES['fileupload']['type'];
$Submit = $_POST['Submit'];
$ok = $_POST['ok'];
if(isset($ok)&&session_is_registered("status")){
$result = mysql_query("UPDATE member SET
name = '".$name."',
nickname= '".$nickname."',
gender = '".$gender."',
email= '".$email."',
office = '".$office."',
position = '".$position."',
bd = '".$birthdate."',
address='".$address."',
province= '".$province."',
zip='".$zip."',
phone='".$phone."',
modified_date='".$timenow."',
ip='".$ip."'
WHERE username = '".$_SESSION[login_true]."' ")or die("cannot update");
// เปลี่ยนภาพ
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") {
$result2=mysql_query("select max(id) from member ");
$row=mysql_fetch_row($result2);
$photoname=$row[0].".".$lastname;
copy($fileupload,"MyResize/".$photoname);
$result3=mysql_query("UPDATE member SET pic = '".$photoname."', where id='".$row[0]."' ");
}
unlink($fileupload);
}
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2010-08-26 15:51:43 |
By :
aakkeng |
View :
1038 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลอง debug ตรง if ($lastname=="gif" or $lastname=="jpg" or $lastname=="jpeg") { ว่ามันเข้าทำงานส่วนนี้หรือเปล่า
การ debug ไม่ยากครับ
Code (PHP)
if ($lastname=="gif" or $lastname=="jpg" or $lastname=="jpeg") {
{
echo "กำลังเข้าอื่นไขนี้จ้าาาา"; // ตรวจสอบการ debug
exit();
|
 |
 |
 |
 |
Date :
2010-08-26 16:16:02 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|