garethhall Posted January 25, 2010 Share Posted January 25, 2010 I saw some code that looks like this while($pages = @mysql_fetch_assoc($rs_pages)) { } So what is the difference between @mysql_fetch_assoc() vs mysql_fetch_assoc() What does the @ do? Link to comment https://forums.phpfreaks.com/topic/189667-what-is-the-difference/ Share on other sites More sharing options...
Zane Posted January 25, 2010 Share Posted January 25, 2010 The @ symbol supresses errors. It keeps your script from halting if say.... $rs_pages wasn't "a valid MySQL result resource" which is a very very common error. It usually occurs when an SQL statement has a typo in it.. so to speak. The symbol is good for debugging ... if you didn't care whether or not that line failed or not. Link to comment https://forums.phpfreaks.com/topic/189667-what-is-the-difference/#findComment-1001001 Share on other sites More sharing options...
salathe Posted January 25, 2010 Share Posted January 25, 2010 The symbol is good for debugging ... if you didn't care whether or not that line failed or not. The symbol is awful for debugging! Please don't just use it because it's a convenient hack, check that what you're providing to the function is proper before using it as an argument. Link to comment https://forums.phpfreaks.com/topic/189667-what-is-the-difference/#findComment-1001180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.