Welcome Guest, Not a member yet? Register   Sign In
Undefined index
#2

[eluser]paulcj2[/eluser]
I fixed it with:
Code:
$header_data['hm_pg_title'] = array();
    $header_data['hm_pg_descrip'] = array();
Now I'm getting:
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined variable: hm_pg_text
Filename: views/homepage.php
Line Number: 30
The controller code is:
Code:
//------------------------------------------------------------------------
        //get page content
        //------------------------------------------------------------------------
        $page_data["hm_pg_title"] = array();
        $page_data["hm_pg_text"] = array();
        $this->load->database();
        $sql = "
            SELECT
                hm_pg_title,
                hm_pg_text
            FROM
                website
            WHERE
                site_address = '$site_address'";
        $rs = $this->db->query($sql);
        foreach ($rs->result() as $row) {
            $page_data['hm_pg_title'] = $row->hm_pg_title;
            $page_data['hm_pg_text'] = $row->hm_pg_text;
            }
The views code is:
Code:
//to display home page values
        echo "<li>Page title: $hm_pg_title</li>\n";
        echo "<li>Site address: $site_address</li>\n";
        echo "<li>Text: $hm_pg_text</li>\n"; //line 30
Why would $hm_pg_title work, but not $hm_pg_text?


Messages In This Thread
Undefined index - by El Forum - 09-09-2008, 11:17 AM
Undefined index - by El Forum - 09-09-2008, 04:33 PM
Undefined index - by El Forum - 09-09-2008, 05:33 PM
Undefined index - by El Forum - 09-23-2008, 04:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB