...

View Full Version : "@" needed? mysql_connect



sitNsmile
02-09-2010, 06:46 PM
Okay, I've been doing a lot of coding, and I dont see what this is used for?


@mysql_connect why not just
mysql_connect

or same thing
@mysql_select_db to
mysql_select_db

what is the whole "@" deal?

Thanks

Fou-Lu
02-09-2010, 07:07 PM
@ is the supression operator. Any errors that may be tossed by the usage of the function are ignored. @ is almost never required with proper error checking and trapping.

sitNsmile
02-09-2010, 07:12 PM
Okay thanks. but is it more recommended to use it?

bdl
02-09-2010, 07:41 PM
Although I'm guilty of using the error suppression operator myself on occasion, IMHO it is not recommended to use it, but rather to use proper error handling as Fou-Lu mentioned.

PHP Language Reference (http://www.php.net/langref) : Operators (http://us2.php.net/manual/en/language.operators.php) : Error control operators (http://us2.php.net/manual/en/language.operators.errorcontrol.php)

Keep that language reference handy, I recommend reading through it as much as you can to gain a good grasp on PHP.

JAY6390
02-09-2010, 08:25 PM
You should never need to use it with any well written code.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum