2016-05-11 17 views
-3

に/var/www/html/cdf/application/models/Appointment_model.phpに変数(T_VARIABLEを)期待しては、これは私が生成した画面 (上のエラーですコード使用crudigniter) A PHPエラーが発生しました

重大度:解析エラー

メッセージ:構文エラー)変数(T_VARIABLE期待し、 '$'、予期しない

ファイル名:モデル/ Appointment_model.php

行番号:17

バックトレース: はここに私のコードあなたは正しく、変数の名前を指定する必要が

/* 
*Appointments Controller in controllers/Appointments.php 
*/ 
<?php 
/* 
* Generated by CRUDigniter v2.0 Beta 
* www.crudigniter.com 
*/ 

class Appointment extends CI_Controller 
{ 
    function __construct() 
    { 
     parent::__construct(); 
     $this->load->model('Appointment_model'); 
    } 

    /* 
    * Listing of appointments 
    */ 
    function index() 
    { 
     $data['appointments'] = $this->Appointment_model->get_all_appointments(); 
     $this->load->view('appointment/index',$data); 
    } 

    /* 
    * Adding a new appointment 
    */ 
    function add() 
    { 
     if(isset($_POST) && count($_POST) > 0)  
     { 
      $params = array(
       'id' => $this->input->post('id'), 
       'appointee_name' => $this->input->post('appointee_name'), 
       'appointment_reason' => $this->input->post('appointment_reason'), 
       'appointment_date' => $this->input->post('appointment_date'), 
       'recorded_by' => $this->input->post('recorded_by'), 
       'dateadded' => $this->input->post('dateadded'), 
      ); 

      $appointment_id = $this->Appointment_model->add_appointment($params); 
      redirect('appointment/index'); 
     } 
     else 
     { 
      $this->load->view('appointment/add'); 
     } 
    } 

    /* 
    * Editing a appointment 
    */ 
    function edit($) 
    { 
     // check if the appointment exists before trying to edit it 
     $appointment = $this->Appointment_model->get_appointment($); 

     if(isset($appointment[''])) 
     { 
      if(isset($_POST) && count($_POST) > 0)  
      { 
       $params = array(
        'id' => $this->input->post('id'), 
        'appointee_name' => $this->input->post('appointee_name'), 
        'appointment_reason' => $this->input->post('appointment_reason'), 
        'appointment_date' => $this->input->post('appointment_date'), 
        'recorded_by' => $this->input->post('recorded_by'), 
        'dateadded' => $this->input->post('dateadded'), 
       ); 

       $this->Appointment_model->update_appointment($,$params);    
       redirect('appointment/index'); 
      } 
      else 
      { 
       $data['appointment'] = $this->Appointment_model->get_appointment($); 

       $this->load->view('appointment/edit',$data); 
      } 
     } 
     else 
      show_error('The appointment you are trying to edit does not exist.'); 
    } 

    /* 
    * Deleting appointment 
    */ 
    function remove($) 
    { 
     $appointment = $this->Appointment_model->get_appointment($); 

     // check if the appointment exists before trying to delete it 
     if(isset($appointment[''])) 
     { 
      $this->Appointment_model->delete_appointment($); 
      redirect('appointment/index'); 
     } 
     else 
      show_error('The appointment you are trying to delete does not exist.'); 
    } 

} 

Error screenshot

+0

どのラインがライン番号17であるかをご記入ください。 –

+0

'function edit($)' –

+0

'$ this-> Appointment_model-> update_appointment($、$ params);'その孤独な '$'がどこにあるのかを理解する;-)。 '$ data ['appointment'] = $ this-> Appointment_model-> get_appointment($);' – Darren

答えて

4

です。 $は有効な変数ではありません

function edit($) 
{ 
    // check if the appointment exists before trying to edit it 
    $appointment = $this->Appointment_model->get_appointment($); 

($)を変数に変更してください。たとえば($ id)を更新して、get_appointment($id)を更新してください。

function edit($id) 
{ 
    // check if the appointment exists before trying to edit it 
    $appointment = $this->Appointment_model->get_appointment($id); 
関連する問題