Wrong Updating Table

Hello everyone!

In a view I use this snippet:


<?php 

	echo CHtml::ajaxSubmitButton (

	   ' ++ ',

	   array('/searchDriver/increasePoint'),

	   array(

	     'type'=>'POST',

	     'data' => array('id' => $someValue)

	   )			            

	);

?>



in searchDriverController I have an action like this:




        public function actionIncreasePoint()

	{	

	   $connection = yii::app()->db;

           $sql = "UPDATE xeom_driver SET driver_point = driver_point  + 1 WHERE driver_id = ".$_POST['id'].";";

           $command=$connection->createCommand($sql);

           $command->execute();


	}



The weird thing happens here is that: the value of driver_point is not increased by 1. In fact it’s increased by 2.

I know that the sql is working. For example if I set driver_point to some value.

Has anybody faced this situation and have explanation ?

Thanks in advanced!

If nothing else, I think you might have a security issue with that sql.

Other than that, are you using renderpartial? : http://www.yiiframework.com/forum/index.php/topic/24699-yii-20-ajaxrenderpartial-conflict/

And what is this: “’ ++ ',”?

I’m really not sure what this does in your app, but ++ typically increases a value by 1, but you do this in you sql as well… just wondering.

All the best :)