hi guys
i have problem "Object of class CDbDataReader could not be converted to int "
public function actionTake() {
$model = new Barang('create');
if (isset($_POST['Barang']['KodeBarang'])) {
//$_POST['Materiil']['lokasi'] = $model->lokasi;
$model->attributes = $_POST['Barang'];
(int)$b = $_POST['Barang']['jumlah'];
$sql1 = 'SELECT Stock FROM barang WHERE KodeBarang ="'. $_POST['Barang']['KodeBarang'] . '"';
$dbcomand = Yii::app()->db->createCommand($sql1)->query();
$data = (int)$dbcomand;
$tampung = $data - $b;
$sql = 'UPDATE barang SET Stock=' . $tampung . ' WHERE KodeBarang="' . $_POST['Barang']['KodeBarang'] . '"';
$dbs = Yii::app()->db->createCommand($sql);
$dbs->queryAll();
$this->redirect(array('admin'));
}
$this->render('take', array('model' => $model));
}
what i should did to fix that problem,