[eluser]thoque[/eluser]
Hi I am new to php programming and obviously new to Codeigniter. I was following a tutorial but my code is not working.
The output is as following:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'{'' or `'$'' in C:\wamp\www\CodeIgniter_1.7.1\system\application\controllers\helloworld.php on line 7
Code:
//helloworld_view.php
<html>
<head>
<title><?=$page_title?></title>
</head>
<body>
<?php foreach($result as $row):?>
<h3><?=$row->title?></h3>
<p><?=$row->text?></p>
<br />
<?php endforeach;?>
</body>
</html>
//helloworld.php
<?php
class Helloworld extends Controller{
function index()
{
$this->load->model('helloworld_model');
$data['result'] = $this->helloworld_model-><span class="sql">getData</span>();
$data['page_title'] = "CI Hello World App!";
$this->load->view('helloworld_view',$data);
}
}
?>
//helloworld_model.php
<?php
class Helloworld_model extends Model {
function Helloworld_model()
{
// Call the Model constructor
parent::Model();
}
function getData()
{
//Query the data table for every record and row
$query = $this->db->get('data');
if ($query->num_rows() < 0)
{
//show_error('Database is empty!');
}else{
return $query->result();
}
}
}
?>
Could any body tell me what is wrong here.