SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru afridy's Avatar
    Join Date
    Mar 2007
    Posts
    971
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to bypass an error message

    Hai,

    assume i have the follwing function
    PHP Code:
    unlink("../temp/index.jpg"); 
    If the index.jpg does not exist, Normally a file not found error message appear. i just want to bypass this error message if the file does not exist.

    it will be like 'On error Resume Next'.

    Please tell me how to do it in php

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Put @ before the function name:
    PHP Code:
    @unlink("../temp/index.jpg"); 

  3. #3
    SitePoint Guru afridy's Avatar
    Join Date
    Mar 2007
    Posts
    971
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Raffles View Post
    Put @ before the function name:
    PHP Code:
    @unlink("../temp/index.jpg"); 
    Thanks Raffles, Thanks.
    Actually what is the real meaning of the @ in php

  4. #4
    Worship the Krome kromey's Avatar
    Join Date
    Sep 2006
    Location
    Fairbanks, AK
    Posts
    1,621
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP questions? RTFM
    MySQL questions? RTFM

  5. #5
    SitePoint Guru afridy's Avatar
    Join Date
    Mar 2007
    Posts
    971
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kromey View Post
    Thank you kromey and got it.

  6. #6
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could always do this as well:
    PHP Code:
    $file '../temp/image.jpg';
    if(
    is_file($file)) {
    unlink($file);

    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  7. #7
    SitePoint Guru afridy's Avatar
    Join Date
    Mar 2007
    Posts
    971
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by WLHosting View Post
    You could always do this as well:
    PHP Code:
    $file '../temp/image.jpg';
    if(
    is_file($file)) {
    unlink($file);

    Thank you WLHosting for your valuable comment.


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
  •