Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-09-2010, 06:46 PM   PM User | #1
sitNsmile
Regular Coder

 
sitNsmile's Avatar
 
Join Date: Dec 2009
Location: Charlotte, NC
Posts: 354
Thanks: 19
Thanked 2 Times in 2 Posts
sitNsmile is an unknown quantity at this point
"@" needed? mysql_connect

Okay, I've been doing a lot of coding, and I dont see what this is used for?

PHP Code:
@mysql_connect 
why not just
PHP Code:
mysql_connect 
or same thing
PHP Code:
@mysql_select_db 
to
PHP Code:
mysql_select_db 
what is the whole "@" deal?

Thanks
sitNsmile is offline   Reply With Quote
Old 02-09-2010, 07:07 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
@ 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.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 02-09-2010, 07:12 PM   PM User | #3
sitNsmile
Regular Coder

 
sitNsmile's Avatar
 
Join Date: Dec 2009
Location: Charlotte, NC
Posts: 354
Thanks: 19
Thanked 2 Times in 2 Posts
sitNsmile is an unknown quantity at this point
Okay thanks. but is it more recommended to use it?
sitNsmile is offline   Reply With Quote
Old 02-09-2010, 07:41 PM   PM User | #4
bdl
Regular Coder

 
Join Date: Apr 2007
Location: Camarillo, CA US
Posts: 590
Thanks: 4
Thanked 83 Times in 82 Posts
bdl is an unknown quantity at this point
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 : Operators : Error control operators

Keep that language reference handy, I recommend reading through it as much as you can to gain a good grasp on PHP.
bdl is offline   Reply With Quote
Old 02-09-2010, 08:25 PM   PM User | #5
JAY6390
Regular Coder

 
Join Date: Dec 2009
Location: UK
Posts: 495
Thanks: 0
Thanked 58 Times in 58 Posts
JAY6390 is on a distinguished road
You should never need to use it with any well written code.
__________________
My site: JayGilford.com
Resources:
PHP Pagination Class | Getting all page links | Handling PHP Errors properly
If you like a users help, show your appreciation with the rep and thanks buttons :)
JAY6390 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:45 PM.


Advertisement
Log in to turn off these ads.