I'm following a tutorial written in 2007 and they have me create this function with this code.
If I don't create the function and just hardcode it in the the webpage it works.
Here is the code:
function getAllSubjects() {
$query = "SELECT *
FROM subjects
ORDER BY position ASC";
$subjectSet = mysql_query( $query, $connection);
confirmQuery($subjectSet);
return $subjectSet;
}
This is how I implement it in the web page:
$queryArray = getAllSubjects();
When I run the code I get an error stating:
Notice: Undefined variable: connection in "
complaining its from the getAllSubjects() function. I'm creating the $connection variable in a file I call prior to calling this code, shouldn't that be fine? I call them in this order:
require_once("includes/connection.php")
require_once("includes/functions.php")