/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] What Does "@" Do In @mysql_query()?

I was reading through some code a contract programmer wrote for me and I came across this…

[code=php]$result = @mysql_query($query);[/code]

What does the “@” do?

Thanks
CTB

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogOct 17.2006 — It suppresses the automatic error reporting that will be done by that function if it should generate a run-time error. You should only do this if your code checks the return value and does some sort of error-handling if it fails; otherwise you may end up spending an unnecessary amount of time tracking down a bug there. For instance:
[code=php]
$result = @mysql_query($query);
if(!$result)
{
die("Database error near line " . __LINE__ . ". Please contact the webmaster.");
}
[/code]
Copy linkTweet thisAlerts:
@pcthugOct 17.2006 — [FONT=Courier New][url=http://www.php.net/operators.errorcontrol]Error Control Operators[/url][/FONT]
Copy linkTweet thisAlerts:
@chestertbauthorOct 18.2006 — Thanks guys.

Dog... I spent an awful amount of time tracking down bugs in the code I write anyway so I probably wouldn't notice anything different. ;-)
×

Success!

Help @chestertb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...