-2

Possible Duplicate:
Reference - What does this symbol mean in PHP?

I have some php code like

$query="SELECT RollNo,Name FROM student" ;
$result = $mysql->execute_sql_query($query);
while(@$rows = mysql_fetch_array($result))
{
        $studentArray[] = array("rollNo" => $rows['RollNo'], "name" => $rows['Name']);      
 }

My doubt is why use @ in the line

while(@$rows = mysql_fetch_array($result))

Community
  • 1
  • 1
Nandu
  • 2,864
  • 7
  • 29
  • 51
  • it doesn't throw error means.. it spressed error message – GBD Nov 07 '12 at 09:15
  • It suppresses errors -> http://us3.php.net/manual/en/language.operators.errorcontrol.php – Manse Nov 07 '12 at 09:15
  • 2
    Is your question about best practices, or about what `@` means? – deceze Nov 07 '12 at 09:16
  • quick comment, as the question is already closed.. the `@` at that line makes no sense, if one wants to use it at all, it should be before a function or when referencing a variable member ($a[x]).. And the obigatory warning: use mysqli or pdo, never relay on the pure mysql_* functions – cypherabe Nov 07 '12 at 09:24

1 Answers1

2

It suppresses error messages - see Error Control Operators in the PHP manual.

dnlcrl
  • 4,582
  • 3
  • 29
  • 39