mouse_8b Posted January 10, 2007 Share Posted January 10, 2007 Apparently, every search interface on the planet regards the "@" sign as nothing. I would just like an explanation of what it does when put in front of a PHP mySQL function call. Quote Link to comment https://forums.phpfreaks.com/topic/33582-the-sign-what-does-it-do-exactly/ Share on other sites More sharing options...
obsidian Posted January 10, 2007 Share Posted January 10, 2007 The '@' symbol is a run-time error suppressing technique. Basically, what happens is that when you make a mysql function call, if something goes wrong, you'll see some sort of error or warning on your webpage. If you preface the function call with the '@', those errors and/or warnings will disappear. This is typically only a good idea [b]if you are handling errors manually[/b], such as with PHP5's try catch clauses.Hope this helps! Quote Link to comment https://forums.phpfreaks.com/topic/33582-the-sign-what-does-it-do-exactly/#findComment-157332 Share on other sites More sharing options...
mouse_8b Posted January 10, 2007 Author Share Posted January 10, 2007 Thanks a lot. I was wondering why a random "@" would "fix" things. I'm glad I was hesitant to use them. And my apologies if this was in the wrong category. I'm new to PHP and have only seen it in regards to mySQL functions. Quote Link to comment https://forums.phpfreaks.com/topic/33582-the-sign-what-does-it-do-exactly/#findComment-157337 Share on other sites More sharing options...
weknowtheworld Posted January 10, 2007 Share Posted January 10, 2007 I think during programming period you must not use @ sign to see errors in our programming but during final delivery plz. use it.. :) Quote Link to comment https://forums.phpfreaks.com/topic/33582-the-sign-what-does-it-do-exactly/#findComment-157502 Share on other sites More sharing options...
obsidian Posted January 10, 2007 Share Posted January 10, 2007 [quote author=weknowtheworld link=topic=121770.msg501482#msg501482 date=1168453878]I think during programming period you must not use @ sign to see errors in our programming but during final delivery please. use it.. :)[/quote]Actually, I would still discourage using it. At that point, for [i]final production[/i] as you say, I would simply set the server to not display any errors or warnings on your production environment. This is much cleaner than runtime error suppression. Plus, when you test new changes on your dev environment, you don't have to modify all your queries to have the '@' in front of them before moving over to the prod box. IMHO, the closer you can keep your dev and prod code, the better for debugging. The [b]only[/b] time I would recommend someone (blanket statement here) to consider using this method of error suppression is when you're developing with PHP5, and you're using the proper Exception throwing and handling like I mentioned above. Quote Link to comment https://forums.phpfreaks.com/topic/33582-the-sign-what-does-it-do-exactly/#findComment-157515 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.