如何纠正我在函数中遇到的这个错误,下面是我的错误
Warning: mysql_query() expects parameter 2 to be resource, null given in C:\xampp\htdocs\how are things\15_06_widget_corp-final\includes\functions.php on line 40
Database query failed:
第 40 行的代码是这样的
$subject_set = mysql_query($query, $connection);
这是我的功能代码
function get_all_subjects($public = true) {
global $connection;
$query = "SELECT *
FROM subjects ";
if ($public) {
$query .= "WHERE visible = 1 ";
}
$query .= "ORDER BY position ASC";
$subject_set = mysql_query($query, $connection);
confirm_query($subject_set);
return $subject_set;
}