Welcome Guest, Not a member yet? Register   Sign In
Getting parse error but can't figure out why.
#1

[eluser]iamzvonko[/eluser]
Hello,

I'm new to CI so please be patient with me. I'm adding a new page to an existing site basically by copying existing model, view and controller files.

When I try to run the page I get this:
Parse error: syntax error, unexpected T_STRING in /.../application/models/resource_model.php on line 1

The ... are mine so as not to show the real path.

Anyway, I can't see what's wrong. Originally, there was no "?>" in the code so I added that to end. No luck. I've pasted the code in some PHP syntax checking sites and they say there are no syntax errors.

Maybe all I need is a 2nd pair of eyes. Can anyone see what's wrong with this? Any help would be greatly appreciated. Here's the code:

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Resource_model extends CI_Model
{
   function __construct()
   {
      parent::__construct();
      $this->_table_resource = 'resource';
   }

   function get_resourcelist()
   {
      $this->db->select('*, resource.id as resource_id');
      $this->db->from('resource');
      $query = $this->db->get();
      return $query;
   }

   function mod_get_resource_by_id($id)
   {
      $this->db->select('*, resource.id as resource_id');
      $this->db->from('resource');
      $this->db->where("resource.id",$id);
      $query = $this->db->get();
      return $query;
   }

   function insert($table, $values)
   {
      if($this->db->insert($table, $values))
      {
         return $this->db->insert_id();
      }
      else {
         return 0;
      }
   }

   function update($table, $values, $where)
   {
      $this->db->where($where);
      if($this->db->update($table, $values))
      return TRUE;
      else
      return FALSE;
   }
}
?>





Theme © iAndrew 2016 - Forum software by © MyBB