I need help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    I need help

    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.

    PHP Code:
    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&amp;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=611cf47e54f8 2163bc5c74857cd311af

    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
    Error deleting smilie file with
    file link - Resource id #17
    File ID - 10
    File Name - 'Resource id #16'

    the line 614 corresponds to
    PHP Code:
    $res unlink("./smilies/'$file'"); 
    Any help will be appreciated.

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

    Comment


      #3
      your image source query is wrong u need to
      Code:
      $delfile = mysql_fetch_array(mysql_query("SELECT imgsrc FROM ibwf_smilies WHERE id ='$smid'"));
      Creator of
      Epix.Mobi

      Keep an Eye on us Big things coming soon!!!!
      Need something for your site hit me up here

      http://coding-talk.com/forum/main-fo...r-your-wapsite

      Comment


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

        Comment


          #5
          try
          Code:
          $file = mysql_fetch_array(mysql_query($sql));
          Creator of
          Epix.Mobi

          Keep an Eye on us Big things coming soon!!!!
          Need something for your site hit me up here

          http://coding-talk.com/forum/main-fo...r-your-wapsite

          Comment


            #6
            Originally posted by loony View Post
            try
            Code:
            $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

            Comment


              #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.

              Comment


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

                Comment


                  #9
                  Use this:
                  PHP Code:
                  $res unlink("./smilies/'$file[0]'"); 
                  I think it will work :D ... Use thanks button if it's working :D
                  whatmp3.name - search mp3 on mobile

                  Comment


                    #10
                    Originally posted by shad0w View Post
                    Use this:
                    PHP Code:
                    $res unlink("./smilies/'$file[0]'"); 
                    I think it will work :D ... Use thanks button if it's working :D
                    THANK YOU

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

                    PHP Code:
                    $res unlink("./smilies/$file[0]"); 

                    Comment

                    Working...
                    X