Results 1 to 8 of 8

Thread: Difference in function calling

  1. #1

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Difference in function calling

    I was looking about at a few php sites, on some of the mysql functions an '@' sign is at the begining of the function but on others its not?
    PHP Code:
    $rs=@mysql_query($sql$conn);//result resource 
    PHP Code:
    $result mysql_query('SELECT my_col FROM my_tbl'); 
    Whats the differnece with placing the '@' there or not?

    Thanks

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    The @ sign before the function supresses any error messages which the function may generate and send to the browser.

    It gives you the chance to handle errors gracefully and maybe send a description of the error to a log file instead of the clients browser.
    PHP Code:

    $result 
    = @mysql_query('SELECT my_col FROM my_tbl;');

    if (! 
    $result) {
      die (
    'Error extracting data. We hope to resolve this problem soon.');

      
    /* code here to send a description of
           the error to a log file */

    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099
    so will this override the value in the php.ini file for displaying errors and warning?

    Thanks

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    Originally posted by john tindell
    so will this override the value in the php.ini file for displaying errors and warning?

    Thanks
    It will surpress all errors except parse errors and fatal errors.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099
    Thanks

    and i just thought it was there for decoration :P

    Thanks

  6. #6
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by john tindell
    Thanks

    and i just thought it was there for decoration :P

    Thanks
    If it was, it's time to fire the decorator. Ampersands are so much more fashionable.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  7. #7
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    Originally posted by The Hobo
    If it was, it's time to fire the decorator. Ampersands are so much more fashionable.
    ◄☺►mysql_query('SELECT my_col FROM my_tbl;')

    Now that looks much easier on the eye.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  8. #8
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    3 big boxes is easy on the eyes? i think it's ugly.
    Like Archer? Check out some Sterling Archer quotes.

Posting Permissions

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



Click Here to Expand Forum to Full Width