解析错误:语法错误,意外的$ end,期待在RTIRegistrationModel.php中的T_FUNCTION

时间:2011-08-13 08:32:24

标签: zend-framework zend-db zend-db-table

    <?php
/**
 * clmsRegistration
 * 
 * @author MGUCS-07
 * @version 
 */
require_once 'Zend/Db/Table/Abstract.php';
class ClmsRegistrationModel extends Zend_Db_Table_Abstract
{
    /**
     * The default table name 
     */
    protected $_name = "clms_registration";
    protected $_primary = "user_name";


    public static function changePassword($username, $newpassword)
    { //changes the password
        try {
            $chps= new ClmsRegistrationModel();
            $row = $chps->find($username);
            $row1 = $row->current();
            $row1->password=$newpassword;
            $row1->save();
        }
        catch (Zend_Db_Exception $e)
        {
            $e->getMessage();
        }       
    }

    public static function checkUsed($username)
    {  //check whether used or not
        try {
        $table = new ClmsRegistrationModel();
        $row=$table->find($username);
        if($row)
        {
            return 1;
        }}
        catch (Zend_Db_Exception $e)
        {
            $e->getMessage();
        }   

    }

    public static function deleteUser($user_name)
    { //deletes a user
        try { 
            $deluser=new ClmsRegistrationModel();
            $row = $deluser->find($user_name);
            $row1=$row->current();
            $result = $row1->delete();
        }
        catch (Zend_Db_Exception $e)
        {
            $e->getMessage();
        }   
    }

    public static function updateUser($user_name,$district,$email_id,$phone_number)
    {
        //updates the details of the user
        try {
            $upUser = new ClmsRegistrationModel();
            $row = $upUser->find($user_name); 
            $row1=$row->current();
            $row1->district= $district;
            $row1->email_id= $email_id;
            $row1->phone_number= $phone_number;
            $row1->save();
        }
        catch (Zend_Db_Exception $e)
        {
            $e->getMessage();
        }

    }

    public static function getRole($user_name)
    { //gets the role of the user
        try {
            $roq= new ClmsRegistrationModel();
            $u= $roq->fetchRow($roq->select()->where('user_name=?',$user_name));
            return $u->toArray();
        }
        catch (Zend_Db_Exception $e)
        {
            $e->getMessage();
        }   

    }

    public function isActive($user_name)
    { //select active user
        try {
            $roq = new ClmsRegistrationModel();
            $u= $roq->fetchRow($roq->select()->where('user_name=?',$user_name));
            return $u->toArray();
        }
        catch (Zend_Db_Exception $e)
        {
            $e->getMessage();
        }   
    }
    public function setActive($user_nam)
    { //sets user active 
        try {
            $roq = new ClmsRegistrationModel();
            $row= $roq->find($user_nam);
            $row1=$row->current();
            $row1->user_name= $user_nam;
            $row1->status1 = 1;
            $row1->save();
        }
        catch (Zend_Db_Exception $e)
        {
            $e->getMessage();
        }   
    }
    public static function setRole($user_name,$role)
    { //sets the role of the user
        try {
            $reg=new ClmsRegistrationModel();       
            $row = $reg->find($user_name);
            $row1= $row->current();
            $row1->role_organization=$role;
            $row1->save();
        }
        catch (Zend_Db_Exception $e)
        {
            $e->getMessage();
        }   
    }

    public function  register($uname,$pass,$role,$en,$status,$email,$ph,$date,$dis)
    {// function  for registration purposes

         try{

            $reg = new  ClmsRegistrationModel();
            $row =$reg->fetchNew();
            //$row= $row->current();
            $row->user_name = '$uname';
            $row->password = '$pass';
            $row->role = $role;
            $row->employee_name=$en;
            $row->status1=$status;
            $row->email_id =$email;
            $row->phone_number =$ph;
            $row->date =$date;
            $row->District=$dis;
            $row->employe_id =$row->employe_id +1;
            $row->save();
            //$reg->save();
         }
         catch (Zend_Db_Exception $e){
            $e->getMessage();
         }


}
}

这是我的模型类并且收到了该错误。 请告诉我这个错误的原因以及如何调试它。

3 个答案:

答案 0 :(得分:0)

这些都不是正确答案。 if语句中有2个大括号

    if($row)
    {
        return 1;
    }}

答案 1 :(得分:-1)

第1行中删除公开,然后重试

答案 2 :(得分:-1)

试试这个

 $reg = new  ClmsRegistrationModel();
            $row1 =$reg->createRow();
            $row1->user_name = $uname;
            $row1->password= $pass;
            $row1->role = $role;
            $row1->employee_name=$en;
            $row1->status1=$status;
            $row1->email_id =$email;
            $row1->phone_number =$ph;
            $row1->date =$date;
            $row1->District=$dis;


        $row1->save();