[eluser]dantrag1989[/eluser]
Hi Folks,
This is my first go around with CI so please be kind :-). I am trying to mash together something resembling one of my old projects in CI as I like the things that I have heard and seen from it. So far, its a bit slow going but I do see how once you understand it will be much faster. So anywho...
I have run into the following problem:
Quote:Parse error: syntax error, unexpected T_STRING in /usr/home/sburke2/public_html/demo/codeigniter/system/application/models/dbfunc_model.php on line 26
Simple right? Nope. I have commented out everything that is being called in dfunc_model and it is still throwing the error. I was hoping that you folks could at least point me in the right direction.
Here is the controller:
Code:
<?php
class Display_results extends Controller {
function index()
{
echo 'Here are your Results';
$this->db->load('library');
}
function results()
{
$this->load->model('dbfunc_model');
$data['query'] = $this->dbfunc_model->display_list();
$this->load->view('results', $data);
}
}
?>
Model:
Code:
<?php
class dbfunc_model extends Model
{
function dbfunc_model()
{
parent::Model();
}
function insert_update()
{
$this->load->database('library');
$data = array('upload_data' => $this->upload->data());
$file_path = $data['upload_data']['file_name'];
$time=now();
$name = $this->input->post('title');
$cat = $this->input->post('catagory');
$descrip = $this->input->post('description');
$sql = "INSERT INTO library (name, cat, descrip, path, timestamp) VALUES(?, ?, ?, ?, ?)";
$this->db->query($sql, array($name, $cat, $descrip, $file_path, $time));
}
function display_list()
{
//$this->load->database('library');
$query = $this->db->query(SELECT * FROM library);
return $query;
//$sql = "SELECT * FROM library WHERE cat=Training";
//$this->db->query($sql);
{
}
?>
and the View:
Code:
<table>
<tr>
<th>ID</th>
<th>Title</th>
<th>Catagory</th>
<th>Description</th>
<th>File Path</th>
<th>Uploaded</th>
</tr>
<?php
if($query->num_rows() > 0):
foreach ($query->result() as $row):
?>
<tr>
<td><?php echo $row->id; ?></td>
<td><?php echo $row->name; ?></td>
<td><?php echo $row->cat; ?></td>
<td><?php echo $row->descrip; ?></td>
<td><?php echo $row->path; ?></td>
<td><?php echo $row->timestamp; ?></td>
</tr>
<?php
endforeach;
endif;
?>
</table>
Any help would be appreciated.