SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot Teraflops's Avatar
    Join Date
    Apr 2002
    Location
    NYC
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Unlinking image from directory

    Hey,
    I develop my to code unlink the image from the directory it sits in,
    and I also have it delete the information from the database. The only
    problem that exist so far is a stupid parse error. I look over the code,
    and not sure what is the probem. It be appreciated if some one can
    help out.

    PHP Code:
    <?php
    include ('../../config/one_config.php');
    $dbcnx=@mysql_pconnect($localhost,$username,$password);
     if (!
    $dbcnx){
       echo (
    "<p> Unable to Connect to the" 
        
    "Link Center at this time.</p>");
      exit();
      }
    mysql_select_db($linkdb);
    $main=@mysql_query("SELECT * FROM linkage WHERE id=$id");
     if (!
    $main) {
        echo(
    "<p>Error fetching details: " .
          
    mysql_error() . "</p>");
        exit();
      }
     
    $r mysql_fetch_array($main);
     
     
    $id=$r["id"];
     
    $name=$r["name"];
     
    $url=$r["url"];
     
    $totalcount=$r["totalcount"];
     
    $todaycount=$r["todaycount"];
     
    $timestamp=$r["timestamp"];
     
    $created=$r["created"];
        
    $picname=$r["picname"];
     
    $email=$r["email"];
     
    $ok1 unlink("/wwwrooot/One/lk_image/$r[picname]"); 
    if (
    $ok1) {
     echo(
    "<p><font color=\"#FF9900\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Remove file succesfully from folder</font></p>");
     }else{
     echo(
    "<p><font color=\"#FF0000\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Error Deleteing File!<br />" 
      
    "Error" mysql_error() . "</font></p>");
      exit();
    $ok2 = @mysql_query("DELETE FROM linkage where id=$id");
    if (
    $ok2) {
     echo(
    "<p><font color=\"#FF9900\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Link deleted succesfully!</font></p>");
     } else {
     echo(
    "<p><font color=\"#FF0000\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Error Deleteing from Database!<br />" 
      
    "Error" mysql_error() . "</font></p>");
     }
    ?>
    </p>
    <p><a href="../../links.php" class="link">Return to Link List</a></p>
    </body>
    </html>
    This is the error . (lin 60 in this code is where "</html>" is)
    Code:
     
    Parse error: parse error in E:\Inetpub\wwwroot\One\controlone\admin\Link_files\deletelink.php on line 60
    OneX Square Creation
    One man said Why ? ... Another man said Why not ?

  2. #2
    SitePoint Addict CeleronXL's Avatar
    Join Date
    Dec 2002
    Location
    United States of America
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Which one is line 60?

  3. #3
    SitePoint Zealot Teraflops's Avatar
    Join Date
    Apr 2002
    Location
    NYC
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Line 60 is
    </html>
    OneX Square Creation
    One man said Why ? ... Another man said Why not ?

  4. #4
    SitePoint Addict CeleronXL's Avatar
    Join Date
    Dec 2002
    Location
    United States of America
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah.
    PHP Code:
    $ok1 unlink("/wwwrooot/One/lk_image/$r[picname]); 
    if (
    $ok1) {
    echo(
    "<p><font color=\"#FF9900\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Remove file succesfully from folder</font></p>" );
    } else {
    echo(
    "<p><font color=\"#FF0000\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Error Deleteing File!<br />" 
    "Error" mysql_error() . "</font></p>" );
    exit();
    }
    $ok2 = @mysql_query("DELETE FROM linkage where id=$id);
    if (
    $ok2) {
    echo(
    "<p><font color=\"#FF9900\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Link deleted succesfully!</font></p>" );
    } else {
    echo(
    "<p><font color=\"#FF0000\" size=\"-1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Error Deleteing from Database!<br />" 
    "Error" mysql_error() . "</font></p>" );

    Missed a closing }.

  5. #5
    SitePoint Zealot Teraflops's Avatar
    Join Date
    Apr 2002
    Location
    NYC
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ya that work.
    Well since that work there is always another problem.
    $ok1 works fine, but $ok2 fails to delete the information from the database. Anyone can help me re-approach this ?

    Thanks
    OneX Square Creation
    One man said Why ? ... Another man said Why not ?

  6. #6
    As the name suggests... trickie's Avatar
    Join Date
    Jul 2002
    Location
    Melbourne, Australia
    Posts
    678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is the error message being thrown?

  7. #7
    SitePoint Zealot Teraflops's Avatar
    Join Date
    Apr 2002
    Location
    NYC
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Error message is this :

    Remove file succesfully from folder
    Error Deleteing from Database!
    Error

    The first line stating "remove file..." is variable $ok1 and the second is $ok2

    OneX Square Creation
    One man said Why ? ... Another man said Why not ?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •