Welcome Guest, Not a member yet? Register   Sign In
CI Noob having a problem...suprised?
#1

[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>
&lt;?php
if($query->num_rows() > 0):
   foreach ($query->result() as $row):
?&gt;    
    <tr>
        <td>&lt;?php echo $row->id; ?&gt;</td>
        <td>&lt;?php echo $row->name; ?&gt;</td>
        <td>&lt;?php echo $row->cat; ?&gt;</td>
        <td>&lt;?php echo $row->descrip; ?&gt;</td>
        <td>&lt;?php echo $row->path; ?&gt;</td>
        <td>&lt;?php echo $row->timestamp; ?&gt;</td>
    </tr>
&lt;?php
    endforeach;
endif;
?&gt;
</table>

Any help would be appreciated.


Messages In This Thread
CI Noob having a problem...suprised? - by El Forum - 07-10-2008, 08:50 AM
CI Noob having a problem...suprised? - by El Forum - 07-10-2008, 09:01 AM
CI Noob having a problem...suprised? - by El Forum - 07-10-2008, 09:53 AM
CI Noob having a problem...suprised? - by El Forum - 07-10-2008, 09:56 AM
CI Noob having a problem...suprised? - by El Forum - 07-10-2008, 10:05 AM
CI Noob having a problem...suprised? - by El Forum - 07-10-2008, 10:19 AM
CI Noob having a problem...suprised? - by El Forum - 07-10-2008, 11:55 AM
CI Noob having a problem...suprised? - by El Forum - 07-10-2008, 02:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB