Welcome Guest, Not a member yet? Register   Sign In
Select View
#11

[eluser]ealonw[/eluser]
I removed the extra helpers... It doesnt like line 4 which is this-->
<?php foreach ($query->result() as $row): ?>

We did make some progress because I can now get to the view page..
#12

[eluser]ealonw[/eluser]
This is what it says...

A PHP Error was encountered
Severity: Notice

Message: Undefined variable: query

Filename: views/contact_view.php

Line Number: 4
#13

[eluser]Brandon Dickson[/eluser]
You need to put any values that you are passing to a view in an array or an object as CI extracts the array (or object properties) into the current scope when it loads the view.

so...

Code:
$this->load->view('contact_view', $query);

becomes:

Code:
$this->load->view('contact_view',array('query'=>$query));

-Brandon
#14

[eluser]ealonw[/eluser]
Brandon and Stuffradio!!! Thank you so much man.. Here is what I did for my controller... Adding the query line at the end and changing the order of my curly bracet to close with two at the bottom made the difference.. My view works now..

class Contact extends Controller {
function contact()
{
parent::Controller();
$this->load->library('database');
$this->load->helper(array('form', 'url'));
$this->load->scaffolding( 'usercomment');
}
function index()
{
// Produces: SELECT * FROM mytable
$query = $this->db->get('usercomment');
$this->load->view('contact_view',array('query'=>$query));
}
}

This case is now closed...




Theme © iAndrew 2016 - Forum software by © MyBB