narjis Posted May 22, 2011 Share Posted May 22, 2011 in the following code I am unable to understand the purpose of @ function get_categories(){ //query database for a list of categories $conn = db_connect(); $query ="select catid, catname from categories"; $result = @$conn->query($query); if (!$result){ return false; } $num_cats = @$result->num_rows; if($num_cats==0) { return false; } $result = db_result_to_array($result); return false; } function db_result_to_array($result) { $res_array = array(); for ($count=0; $row = $result->fetch_assoc(); $count++){ $res_array[$count] = $row; } return $res_array; } Link to comment https://forums.phpfreaks.com/topic/237082-please-explain/ Share on other sites More sharing options...
mgoodman Posted May 22, 2011 Share Posted May 22, 2011 @ simply suppresses any error messages that $conn->query() may generate. http://us.php.net/manual/en/language.operators.errorcontrol.php Link to comment https://forums.phpfreaks.com/topic/237082-please-explain/#findComment-1218569 Share on other sites More sharing options...
Pikachu2000 Posted May 22, 2011 Share Posted May 22, 2011 You should remove it from the code and, with very limited exception, forget it exists unless it's part of an email address. Link to comment https://forums.phpfreaks.com/topic/237082-please-explain/#findComment-1218570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.