0

Is this wrong?

I get this error when I run the following code. I just want to write the delete function in the model in a way that I can reuse it.

Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in C:\xampp\htdocs\SMP\application\controllers\Student.php on line 101 A PHP Error was encountered

Severity: Parsing Error

Message: syntax error, unexpected '=>' (T_DOUBLE_ARROW)

Filename: controllers/Student.php

Line Number: 101

Backtrace:

Model

   function delete_by_id($id,$table)
{
    $this->db->where($id);
    $this->db->delete($table);
}

Controller

 public function student_delete($id)
{
    $this->load->model('Model_Action');
    $this->Model_Action->delete_by_id('p_id'=>$id, 'parent');
    echo json_encode(array("status" => TRUE));
}
tereško
  • 58,060
  • 25
  • 98
  • 150
deeva
  • 75
  • 10

1 Answers1

0

Change your array syntax like below:

public function student_delete($id)
{
    $this->load->model('Model_Action');
    $this->Model_Action->delete_by_id('p_id = '. $id, 'parent');
    echo json_encode(array("status" => TRUE));
}
Rohit Mittal
  • 2,064
  • 2
  • 8
  • 18