@ for what?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

@ for what?

Post by mariolopes »

I'm study php now and i have a question (very beginner question I suppose). Why the use of the @ symbol in following code:
function ligacao(){
$connection = @mysql_connect('localhost', 'curso', '123');
mysql_select_db('vendas',$connection);
Thank you guys
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: @ for what?

Post by AbraCadaver »

@ suppresses errors. You probably shouldn't use it. Turn on error reporting for development and turn it off for production.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

Re: @ for what?

Post by mariolopes »

Great
Thank you
Post Reply