Getting Undefined function error message for a function that's defined
<p>I'm getting the following error message</p>

<blockquote>
  <p>Fatal error: Call to undefined
  function get_subject_by_id() in
  /hsphere/local/home/c263430/prupt.com/content.php
  on line 25</p>
</blockquote>

<p>This is the function at line 25</p>

<pre><code> $sel_subject = get_subject_by_id($sel_subj);
</code></pre>

<p>This is the function it refers to. How can it be "undefined" as the error message says? Can anyone help?</p>

<pre><code>function get_subject_by_id($subject_id) {
    global $connection;
    $query = "SELECT * ";
    $query .= "FROM subjects ";
    $query .= "WHERE id='" . mysql_real_escape_string($subject_id) ."' ";
                       // note the quotes and escaping wrapper
    $query .= "LIMIT 1";
    $result_set = mysql_query($query, $connection);
    confirm_query($result_set);
    // if no rows are returned, fetch array will return false
    if ($subject = mysql_fetch_array($result_set)) {
        return $subject;
    } else {
        return NULL;
    }
}
</code></pre>

<p>Below is the whole code of the page where the function is called</p>

<pre><code>&lt;?php

    //1.Create a database connection
    $connection = mysql_connect("98.130.0.87", "User", "Pass");
    if (!$connection) {
        die("Database connection failed: " . mysql_error());
    }
    $db_select = mysql_select_db("C263430_testorwallo" ,$connection);
    if (!$db_select) {
        die("Database selection failed: " . mysql_error());
    }

    ?&gt;

    &lt;?php
        if (isset($_GET['subj'])){

        $sel_subject = get_subject_by_id($_GET['subj']);
        $sel_pg = 0;
        $sel_page = NULL;
        } elseif (isset($_GET['page'])) {
        $sel_subject = NULL;
        $sel_page = get_page_by_id($_GET['page']);
        } else {
        $sel_subject = NULL;
        $sel_page = NULL;
        }

        ?&gt;
    &lt;?php require_once("includes/functions.php"); ?&gt;
    &lt;?php include("includes/header.php"); ?&gt;

    &lt;table id="structure"&gt;
                &lt;tr&gt;
                    &lt;td id="navigation"&gt;
                    &lt;ul class="subjects"&gt;

                    &lt;?php

                    $subject_set = get_all_subjects();

                    while ($subject = mysql_fetch_array($subject_set)){
                    echo "&lt;li ";
                    if ($subject["id"] == $sel_subject['id']) {
                    echo " class=\"selected\"";
                    }
                    echo "&gt;&lt;a href=\"content.php?subj=" . urlencode($subject["id"]) . "\"&gt;
                    {$subject["menu_name"]}&lt;/a&gt;&lt;/li&gt;";
                    $page_set = get_pages_for_subject($subject["id"]);

                    echo "&lt;ul class=\"pages\"&gt;";
                    while($page = mysql_fetch_array($page_set)){
                        echo "&lt;li";
                        if ($page["id"] == $sel_page['id']) {
                    echo " class=\"selected\"";
                    }
                        echo "&gt;&lt;a href=\"content.php?page=" . urlencode($page["id"]) . "\"&gt;{$page["menu_name"]}&lt;/a&gt;&lt;/li&gt;";

                        }
                        echo"&lt;/ul&gt;";
                        }


                    ?&gt;

                        &lt;/ul&gt;
                    &lt;/td&gt;
                    &lt;td id="page"&gt;
                        &lt;?php if (!is_null($sel_subject)) {
                        &lt;h2&gt;&lt;?php echo $sel_subject['menu_name']; ?&gt;&lt;/h2&gt;
                        &lt;?php } else if (!is_null($sel_page)) {
                        &lt;h2&gt;&lt;?php echo $sel_page['menu_name]; ?&gt;&lt;/h2&gt;
                        &lt;?php } else {
                        &lt;h2&gt; Select a subject or page to edit &lt;/h2&gt;
                        &lt;?php } ?&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;/table&gt;
    &lt;?php include("includes/footer.php"); ?&gt;
</code></pre>
