我尝试创建一个简单的个人资料编辑页面。不在乎语法,我已经提炼了
<?php
$resultMember = mysql_query("SELECT * FROM member WHERE email='".$_SESSION['memberEmail']."'");
..
$oldProfilePhoto = $resultMember['pp'];
..
{ //post controll
$W = " WHERE email='".$_SESSION['memberEmail']."' AND pasw='".$_SESSION['memberPsw']."'";
if(!isset($_FILES['profilePhoto']['value'])){
mysql_query("UPDATE member SET pp='".$oldProfilePhoto."'".$W) or die(mysql_error());
}
$profilePhoto = "inc/img/".$_SESSION['memberSkype']."/".$_FILES['profilePhoto']['name'];
move_uploaded_file($_FILES['profilePhoto']['tmp_name'],$profilePhoto);
mysql_query("UPDATE uye SET pp='".$profilePhoto."'".$W) or die(mysql_error());
}
..
?>
所以,图片上传(OK),oldPhotoName 获取(OK),用户选择邮寄的照片(OK),简而言之(OK),但在尝试更改个人资料照片后首先更改个人资料照片返回为空。未添加旧照片,
如果用户选择照片,旧照片不会改变。
感谢您的关注。干得好..