Forum Moderators: coopster

Message Too Old, No Replies

Unknown operand '@'?

         

PickleHead

5:56 am on Apr 13, 2007 (gmt 0)

10+ Year Member


if(!@mysql_query(...)) { ... }

What is the '@' called in php/mysql?
What does it do explicitly?

Can you point me to any documentation please.
google returns nothing, or do I have to escape it to search it right?
Can't figure it out, nothing in MySQL page or PHP page, that I can find.
See it in a lot of tutorials, but they just say "dont worry about that just keep going we'll explain it later" but never do.

adb64

6:26 am on Apr 13, 2007 (gmt 0)

10+ Year Member



When an @ precedes a function call this will suppress a possible error message to be send to the clients browser.
Example:

$fp = @fopen("filename","r");

When file 'filename' does not exists, PHP would normally print an error message about an invalid stream or something like that. With the @ in front of fopen this message won't be printed. In this example you can later on check $fp whether an error as occurred:

if ($fp)
{
// handle the file
}
else
{
// handle file not found
}

dreamcatcher

7:12 am on Apr 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi PickleHead,

For more information on the PHP error suppression symbol, see this link:
[uk3.php.net...]

dc