I'm having some bug problems in my first php script. It's several thousand lines long, so I'll spare the copy and paste. I think I have traced some of my issues to not having the "@" symbol in front of some mysql calls, such as the following:
@mysql_query($sql, $conn);
and so on and so on.
My question is to the very nature of this lingo. What does the '@' symbol do? Is it always necessary? If not, then when is it needed? I look forward to hearing an answer to this evasive topic (you can't search for the "@" symbol on google. So it's evasive!).
Brad
'@' symbol in front of mysql commands...Why?
Moderator: General Moderators
Putting the @ symbol in front of any built in php command (not just mysql functions) will squelch any error reporting it generates: if you call mysql_select_db("my_db",$some_connection) and $some_connection isn't valid, mysql_select_db() will generate a warning or fatal error (not sure which one). Putting an @ symbol in front of the function will shut it up.
You should never use the @ symbol to make your code 'work'. If a function is outputing an error, there's always a reason - your best bet is to fix it.
That said, there are times when you may be using a function in a condition, and don't care about any errors it could generate. That'd be an ideal place to use the @ symbol.
Make sense?
You should never use the @ symbol to make your code 'work'. If a function is outputing an error, there's always a reason - your best bet is to fix it.
That said, there are times when you may be using a function in a condition, and don't care about any errors it could generate. That'd be an ideal place to use the @ symbol.
Make sense?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
alas. I can see clearly now. That makes my life so much harder. Everything was just skippy when I could magically stop the flow of errors. Oh well, back to the drawing board. I have an idea, someone give me your email address, I'll send you 2,000 lines of code full of errors, you fix it and send it back. Sound chipper? Yeah, if only it were that easy...