Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Update query

$
0
0
Hi alll,


Can anybody tell me how to write an updte query using DAO. Its not explained in the documentation.

My code is as follows:
 $connection=Yii::app()->db;
		 $jc_id=$_GET['id'];
		 $state=$_GET['state'];
		$sql='update job_cards set status =:status where jc_id=:jc_id';
		$command->bindParam(":status",$state,PDO::PARAM_STR);
$command->bindParam(":jc_id",$jc_id,PDO::PARAM_STR);
		$command=$connection->createCommand($sql)->execute();


This code gives as error
Fatal error: Call to a member function bindParam() on a non-object in G:\xampp\htdocs\testyii\damodar\protected\controllers\JobCardsController.php on line 136


Please advice what to do.


Thanks

Viewing all articles
Browse latest Browse all 18717

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>