what's the purpose of the '@' in '@mysql_connect(...)'?

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
User avatar
left-click
Forum Newbie
Posts: 1
Joined: Mon Oct 28, 2002 2:19 pm
Location: barbados

what's the purpose of the '@' in '@mysql_connect(...)'?

Post by left-click »

I am still new to php and I have already seen this @ quite a few times, but I can't seem to find it in the manual.

Also, I have tried the mysql_* functions without the @ prefixing them and they all seem to work fine. Can anyone tell me what exactly is the purpose of the @ before these function call :?:

Cheers,
left-click
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

I think it's for encrypting... don't hold me to that quote though ;)
superwormy
Forum Commoner
Posts: 67
Joined: Fri Oct 04, 2002 9:25 am
Location: CT

Post by superwormy »

@functionname() will suppress any error messages the function returns. So if you connect to the database with @mysql_connect, and the connection fails, it won't show any warning messages. But if you just use mysql_connect and it fails, it'll spit out lots of warning messages.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

that's kinda what I thought. However, I dunno about the last part of that comment. When I try and connect to MySQL and it fails, I don't get any error messages at all. Only way I know to get it to error, is to put a "or die("blah blah blah ERROR R4R"); clause in it heh..
TwinkiE_HunteR-G
Forum Newbie
Posts: 14
Joined: Tue Sep 17, 2002 8:44 am

Post by TwinkiE_HunteR-G »

The '@' is to supress any error messages that call may produce, so you can output one of your own.
f1nutter
Forum Contributor
Posts: 125
Joined: Wed Jun 05, 2002 12:08 pm
Location: London

Post by f1nutter »

Post Reply