hi
If the user changes his photo i want the else to work.if u the does not change his old photo i want the if to work.but my below code is not working like that....only the if part is working

if(isset($_REQUEST["update"]))
{
$uploadedfile=$_REQUEST['uploadingfile'];
$upload="comphoto"."/". $_FILES['uploadingfile']['name'];
$filename=$_FILES['uploadingfile']['name'];
echo $filename;
move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$upload);
if($filename!="NULL" || $filename!="FALSE" || $filename!="")
{
$res=$db->upcommunity($user_id,$name1,$desc,$upload,$username,$password);

}
else
{
$res=$db->upcommunity1($user_id,$name1,$desc,$username,$password);
}
}

hi
If the user changes his photo i want the else to work.if u the does not change his old photo i want the if to work.but my below code is not working like that....only the if part is working

if(isset($_REQUEST["update"]))
{
$uploadedfile=$_REQUEST['uploadingfile'];
$upload="comphoto"."/". $_FILES['uploadingfile']['name'];
$filename=$_FILES['uploadingfile']['name'];
echo $filename;
move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$upload);
if($filename!="NULL" || $filename!="FALSE" || $filename!="")
{
$res=$db->upcommunity($user_id,$name1,$desc,$upload,$username,$password);

}
else
{
$res=$db->upcommunity1($user_id,$name1,$desc,$username,$password);
}
}

Hi...
I didnt get ur above code...
but the procedure is like this...

first u retrive the old photo name....
after take new photo name....than check both of this

if($old==$new){

}


incase if he is not change the photo than u take as null like this...

if(($new==$old) || ($new=="")){

}

i think this is the logic what u want...try to do this,...

if($filename!="NULL" || $filename!="FALSE" || $filename!="")

This must be

if($filename!=NULL && $filename!=FALSE && $filename!="")

In your example, you are checking if variable filename value is NULL or FALSE (which is wrong). And, you should use logical operator "and" instead of "or".

commented: Nicely done ;) +15

thanks naveen its working

:) Cool!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.