Re: unlink problem... please help...
| From: | Ernest E Vogelsinger | Date: | Wed, 26 Feb 2003 15:06:09 +0000 |
| Subject: | Re: unlink problem... please help... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137244@lists.php.net to get a copy of this message | ||
At 16:03 26.02.2003, Jøran Sørbø spoke out and said:
--------------------[snip]--------------------
> if (isset($delimage))
> {
>
>$result=unlink('$dir_to_upload/$Photo');
>
> $result=mysql_query("
> update product set
> Photo='nothing',
> miniPhoto='nothing',
> picture='0'
> where ID=$id
> ") or die (mysql_error(). " : ".mysql_errno());
>
> if ( ($result) != 1)
> print "Sorry,can't delete the image ";
> else
> {
> print "Image was deleted sucsessfully.<br>If you want to upload a
>new image do it now,overwise close the window";
> }
>
> }
>
>but when i execute this, i get the following error...
>
>Warning: unlink() failed (No such file or directory) in one_product.php on
>line 178
>You have an error in your SQL syntax near '= ' at line 6 : 1064
--------------------[snip]--------------------
1) You do not define $dir_to_upload, nor $Photo (at least in your example)
- this would lead to
$result=unlink('/');
hence error 1.
2) You don't define the variable $id (at least in your example), so the SQL
statement would read
"update product set " .
"Photo='nothing', miniPhoto='nothing', picture='0' " .
"where ID="
hence error 2 (after "ID=").
If these values are available on a global level, you must declare them
global within your function.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/