Unable To Update

hi,i unable to update the detail one by one, when i change want update roomtype and refroomtype and time are allowed when i wan update the event and date is unable and keep redirect me to error message.It suppose let me update the whole detail and if i want change my event title only it allow.

my idea is if error mean clash the time,if successful update mean did’t clash with time. Basically i let user to edit the booking detail after they done their booking, if user want change time, they are allow to edit the detail and user find out the unable to update mean the time and room been taken.


public function actionUpdateBookingDetails() {


        $exist1 = Yii::app()->db->createCommand()

                ->select('BookingID,RoomTypeID,RefroomID,TimeID,Event,StartDate,EndDate,Booked')

                ->from('bookingdetail')

                //->where('BookingID=:bookingid',array(':bookingid'=>$_POST['bookingid'] ))

//                ->were('RoomTypeID=:roomTypeId AND RefroomID=:roomId AND TimeID=:timeId AND Event=:event AND StartDate=:start AND EndDate=:end', array(':roomTypeId' => $_POST['roomtype'], ':roomId' => $_POST['referroomtype'],

//                    ':timeId' => $_POST['timeslot'], ':event' => $_POST['Bookingdetail']['Event'], 'start' => $_POST['Bookingdetail']['StartDate'],

//                    'end' => $_POST['Bookingdetail']['EndDate']))

                ->where('RoomTypeID=:roomTypeId AND RefroomID=:roomId AND TimeID=:timeId AND Booked=:booked',array(':roomTypeId' => $_POST['roomtype'], ':roomId' => $_POST['referroomtype'],':timeId' => $_POST['timeslot'],'booked'=>1))

                ->queryAll();


        if (sizeof($exist1) != 0) {

           $this->redirect(Yii::app()->request->hostInfo . Yii::app()->request->baseURL . "/index.php/site/errorupdate");


        } else {

          $bookingID = $_POST['bookingid'];

            $criteria = new CDbCriteria;

            $criteria->addCondition('BookingID="' . $bookingID . '" AND Booked= 1 ');

            Bookingdetail ::model()->updateAll(array(

                'RoomTypeID' => $_POST['roomtype'],

                'RefroomID' => $_POST['referroomtype'],

                'TimeID' => $_POST['timeslot'],

                'Event' => $_POST['Bookingdetail']['Event'],

                'StartDate' => $_POST['Bookingdetail']['StartDate'],

                'EndDate' => $_POST['Bookingdetail']['EndDate'],

                    ), $criteria);

            $this->redirect(Yii::app()->request->hostInfo . Yii::app()->request->baseURL . "/index.php/site/bookingdetail/userId/" . Yii::app()->session['ID'] . "/");

            //$this->redirect(Yii::app()->request->hostInfo . Yii::app()->request->baseURL . "/index.php/site/errorupdate");


        }

Hi,

I think you should check ur safe attribute in rules and backend db details. Have you checked wether you have some validation erorrs :)