I need help

Started on the old forum in July 2009 · view the original in the archive · old links redirect here

9 replies · 349 views · started 17 years ago · 1 min read

4 participants
Guest #1

I have been trying to get this working for days might just be a simple error I have tried almost everything to get it working but still no success. So I thought I would let you guys have a crack at it for me.

the coding is a snippet out of a long page so the headers are not there.

else if($action=="smiliedel"){
$smid = $_GET["smid"];

$sql = "SELECT filename FROM ibwf_smilies WHERE id ='$smid'";
$file = mysql_query($sql);
$delfile = mysql_query("SELECT imgsrc FROM ibwf_smilies WHERE id ='$smid'");
///$delfile = mysql_fetch_array(mysql_query("SELECT imgsrc FROM ibwf_smilies WHERE id='".$smid."'"));

echo "<p align=\"center\">";

echo "<br/>";
$res = unlink("./smilies/'$file'");
if($res){

echo "<img src=\"http://coding-talk.com/images/ok.gif\" alt=\"O\"/>Smilie file deleted successfully";

}else{

echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/>Error deleting smilie file with<br/> file link - $delfile<br/>File ID - ".$smid." <br/>File Name - '$file'  ";
exit();

}
$res = mysql_query("DELETE FROM ibwf_smilies WHERE id='".$smid."'");
if($res){

echo "<img src=\"http://coding-talk.com/images/ok.gif\" alt=\"O\"/>Smilie code deleted successfully<br/><br/>";

}else{

echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/>Error deleting smilie code with<br/> file link - $delfile<br/>File ID - ".$smid." <br/>File Name - '$file'  ";
exit();
}

echo "<a href=\"lists.php?action=smilies&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";

echo "Smilies List</a>";

echo "</p>";

}

The address is domain.co.uk/page.php?action=smiliedel&smid=10&sid=611cf47e54f82163bc5c74857cd311af

The results I am getting is

Warning: unlink(./smilies/'Resource id #16') [function.unlink]: No such file or directory in /home/sites/domain.co.uk/public_html/page.php on line 614 External image (may be gone)Error deleting smilie file with file link - Resource id #17 File ID - 10 File Name - 'Resource id #16'

the line 614 corresponds to

$res = unlink("./smilies/'$file'");

Any help will be appreciated.

clint Junior · 10 posts #2

It would seem that you have a file or directory missing from your script.

Just visiting!

Guest #4

still coming up with almost the same error and why is it printing 'Resource id #16'

Guest #6

loony wrote: try

$file = mysql_fetch_array(mysql_query($sql));

thanks well that stopped it printing

'Resource id #16'

Now it prints 'Array'

Im confused and fed up with this problem now

if anyone can create or modify a script that would do as I want mine to do please quote it here

bijaybd Developer · 178 posts #7

array means it is not getting the file directory for example domain.co.uk/images/1.gif so it its can not find the directory it will show array did you cmd all files to 777 may be some times it occurs problems.

Guest #8

but im getting it when i try print the results from the database

shad0w Developer · 119 posts #9

Use this:

$res = unlink("./smilies/'$file[0]'");

I think it will work 😀 ... Use thanks button if it's working 😀

whatmp3.name - search mp3 on mobile

Guest #10

shad0w wrote: Use this:

$res = unlink("./smilies/'$file[0]'");

I think it will work 😀 ... Use thanks button if it's working :D

👏THANK YOU👏

You almost had it but I got it to work the correct code was

$res = unlink("./smilies/$file[0]");

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close