the isset in my code doesnt seem to do what its suppose to, have i gone wrong somewhere,
echo output.
1 testing-testing-123.jpg
2 SELECT image FROM bands WHERE id = '44'
4 images/bands/thumb/test102.jpg
5 ../images/bands/thumb/test102.jpg
As you can see $row['image'] has content so it is "set" so it should run the unlink code yet it skips it all together.
with the
if no file is being uploaded then it should just skip all this code yet it is being run.
am i going about this the wrong way or have i missed something out.
PHP Code:
echo "1 ".$_FILES['cons_image'.$id[3]]['name']."<br />";
if (isset($_FILES['cons_image'.$id[3]]['name'])){
$q = "SELECT image FROM bands WHERE id = '$id[3]'";
echo "2 ".$q."<br />";
$r = mysql_query($q) or die($q."<br/><br/>".mysql_error());
while($row = mysql_fetch_array($r)){
echo "4 ".$row['image']."<br />";
$file = "../".$row['image'];
echo "5 ".$file."<br />";
}
if (isset($row['image'])){
echo "6 Unlink Area";
exit;
unlink($file);
$file = explode("$table/thumb",$file);
$file = $file[0]."$table".$file[1];
unlink($file);
}
}
exit;
1 testing-testing-123.jpg
2 SELECT image FROM bands WHERE id = '44'
4 images/bands/thumb/test102.jpg
5 ../images/bands/thumb/test102.jpg
As you can see $row['image'] has content so it is "set" so it should run the unlink code yet it skips it all together.
with the
Code:
if (isset($_FILES['cons_image'.$id[3]]['name'])){
am i going about this the wrong way or have i missed something out.
Comment