Welcome Guest, Not a member yet? Register   Sign In
Parse error: syntax error, unexpected T_OBJECT_OPERATOR $this-db->update
#1

[eluser]darian311[/eluser]
Attempted call:
example.com/CodeIgniter/index.php/dbexample/update_user?fb_id=1001&cash=33&coins=22&villagestate=crack

Got

ERROR MESSAGE:

Quote:Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/darhic/labs.villagethegame.com/CodeIgniter/application/controllers/dbexample.php on line 36
Offending line:
Code:
$this-db->update('villagegame', $_GET);
All the other functions on this controller work fine. Any ideas what's wrong with line above?
-Darian

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

class Dbexample extends CI_Controller{

public function dbexample(){
   parent::__construct();
   echo("Get's type:" . gettype($_GET));

}

public function index(){
  $this->load->database();
  $query = $this->db->query('SELECT fb_id, cash, coins FROM villagegame');

  foreach ($query->result() as $row)
  {
      echo $row->fb_id;
      echo $row->coins;
      echo $row->cash;
  }
  
  echo 'Total Results: ' . $query->num_rows();
}

public function add_user(){
  $this->db->insert('villagegame', $_GET);
}

public function delete_user(){
  $this->db->delete('villagegame', $_GET);
}

public function update_user(){
  $this->db->where('fb_id', $_GET['fb_id']);
  unset($_GET['fb_id']);
  $this-db->update('villagegame', $_GET);
  
  
}


}


?>


Messages In This Thread
Parse error: syntax error, unexpected T_OBJECT_OPERATOR $this-db->update - by El Forum - 05-04-2012, 03:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB