At 16:42 26.02.2003, Jøran Sørbø spoke out and said: --------------------[snip]-------------------- >Hi! >Ive tried to change the script sometimes now and it still dont work... >i still get the error Warning: unlink() failed (No such file or directory) >and it wont remove the data form the database.... > >$dir_to_upload is defined in config.php wich is included... >it works just fine to display image using echo "<img >src='$dir_to_upload/$row->Photo'> >$Photo is defined in the following tag in the form <input type=hidden >name='Photo' value='<?=$row->Photo?>'> > > >the variable $id is defined in the following tag in the form <input >type=hidden name='id' value='<?=$row->ID?>'> --------------------[snip]--------------------
There are also errors in how you format the filename passed to unlink(), and in formatting the SQL statement - see below. Do yourself a favour and make the following modification to your script and look at the output: if (isset($delimage)) { $file = "$dir_to_upload/{$row->Photo}"; $sql = "update product set Photo='nothing', miniPhoto='nothing', " . "picture='0' where ID='$id'"; echo "unlink($file);<br />query($sql);<br />"; $result=unlink($file); $result=mysql_query($sql) or die .... -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php