[eluser]face1m[/eluser]
Wow! I have been working on this all day. I could have had my site done by now if i wasn't using codeigniter. Feel the frustration? What seems to work on one site does not work on another. Here is the code... and thanks for feeling the frustration.
<?php
class Home extends Controller {
function __construct()
{
parent::Controller();
}
function index()
{
$data['query'] = $this->hotlotto_model->get_last_ten_entries();
print_r($data);<------ this prints out the last 10 entries and it works
$this->load->view('home_view', $data);
}
}
/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */
?>
----------------------------------------------------------------
<html>
<head>
<title>How to Win Hot Lotto</title>
</head>
<body>
<h1>How to Win Hot Lotto!</h1>
<?php foreach ( $query->result() as $row ): ?> <---This is the error Call to a member
function result() on a non-object on line 16 (this is line 16)
<h3><?=$row->DRAWDATE?></h3>
<p><?=$row->N1?></p>
<p><?=$row->N2?></p>
<p><?=$row->N3?></p>
<p><?=$row->N4?></p>
<p><?=$row->N5?></p>
<p><?=$row->hball?></p>
<hr />
<?php endforeach; ?>
<p><br />Page rendered in {elapsed_time} seconds</p>
</body>
</html>
_______-------------------------------------------------------
this is the result of the print_r()
Array ( [query] => Array ( [0] => stdClass Object ( [DRAWDATE] => 2002-04-10 [N1] => 3 [N2] => 5 [N3] => 6 [N4] => 16 [N5] => 33 [hball] => 5 )
The model is loaded using the auto load file and the database lib.
Thanks for overlooking the frustration!
rick