For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > February 2006 > @mysql_query - whats the difference between this and mysql_query?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author @mysql_query - whats the difference between this and mysql_query?
r-jones@orange.net

2006-02-09, 7:56 am

Sorry for the simplicity of the question, but im a newbie.

Iv seen the mysql_query command written with an @ before it on some
example codes. What, if any, is the difference? And if they are
different, when should you use the @ and what does it do?

Cheers

d

2006-02-09, 7:56 am

<r-jones@orange.net> wrote in message
news:1139487169.480653.33110@z14g2000cwz.googlegroups.com...
> Sorry for the simplicity of the question, but im a newbie.
>
> Iv seen the mysql_query command written with an @ before it on some
> example codes. What, if any, is the difference? And if they are
> different, when should you use the @ and what does it do?
>
> Cheers


Prefixing a function with an @ will hide any error message generated by the
function. If a function will possibly fail, you can prefix it with the @,
then check the return value to see if the function did infact work or not.
It's kind of like a basic version of try/catch. Very basic. :)


r-jones@orange.net

2006-02-09, 7:56 am

cheers very much

great help

J.O. Aho

2006-02-09, 7:56 am

d wrote:
> <r-jones@orange.net> wrote in message
> news:1139487169.480653.33110@z14g2000cwz.googlegroups.com...
>
> Prefixing a function with an @ will hide any error message generated by the
> function. If a function will possibly fail, you can prefix it with the @,
> then check the return value to see if the function did infact work or not.
> It's kind of like a basic version of try/catch. Very basic. :)


It's quite useful if you have enabled error output to the php generated page
and there is something you don't want to the user to see, but of course in
that case it's better to turn off the error output and save errors to a log
file instead.


//Aho
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com