Query Stopped Working Once We Made It A Function
<p>A PHP tutorial gave me the following code to use to do a certain database search. I put it in the content.php file and it was working properly</p>

<pre><code>$query = "SELECT * 
         FROM subjects 
         ORDER BY position ASC";
$subject_set = mysql_query($query, $connection);
confirm_query($subject_set);
</code></pre>

<p>(note, the confirm_query function was the following which it accessed in include.php</p>

<pre><code>function confirm_query($result_set){
if (!$result_set) {
    die("Database query failed: " . mysql_error());
    }
}
</code></pre>

<p>Afterwards, the tutorial was telling me (for the purpose of making it resusable) to turn the $query into a function in the include.php file </p>

<p>Therefore, in include.php we did this</p>

<pre><code>    function get_all_subjects() {
    $query = "SELECT * 
             FROM subjects 
             ORDER BY position ASC";
    $subject_set = mysql_query($query, $connection);
    confirm_query($subject_set);
    return $subject_set;

}
</code></pre>

<p>Next, we accessed this function by using the following in the content.php file</p>

<pre><code> $subject_set = get_all_subjects();
</code></pre>

<p>However, now it said 'database query failed'</p>

<p>So moving the first chunk of code above into the include.php file somehow affected the query</p>

<p>Is that clear? </p>

<p>any ideas how to fix it? </p>
