CSqlDataProvider implements a data provider based on a plain SQL statement. This tutorial will help you to display the custom sql query result into cgridview as normal crud view.
This tutorial will help you to upload the image with image extension validation, image size validation and image dimension validation. So we can fix the width and height for image.
Scenarios validation is the one of the useful future in yii framwork and seperating the validation on any class derived from CModel. For example user registeration and updation will have different validation
Yii have the multiple database connection by default. Yii components is used to make the relation between our models and database. To use the multiple database we have to configure the main.php file
This tutorial will help you to display the image in CDetailview widget of yii framework 1.0. We added a different funcitons in model.php to display the image with different methods like only image, image […]
This tutorial will help you to find the result using DATE_FORMAT() function. ‘DATE_FORMAT’ function is used to convert the integer to date format value. I add the source code for this type of date […]
By default model classes are available within the 'protected/models' dirctory. Every class must be inherit from the CModel or subclass and we explained about yii 1.0 model structure
CDbDataReader reads the rows from a result. CDbDataReader Query <?php $cdbdatareader = Yii::app()->db->createCommand() ->select('username, password') ->from('usermaster') ->query(); ?> columnCount & rowCount <?php echo $cdbdatareader->rowCount; echo $cdbdatareader->columnCount; ?> CDbDataReader Using read(), next() <?php $record=$cdbdatareader->read(); echo […]
Functions function delete($table, $conditions='', $params=array()) The delete() method builds and executes a DELETE SQL statement.’$table’ is a table name of delete from.’$conditions’ and ‘$params’ is like where condition of delete statement Sample <?php $user=Yii::app()->db->createCommand() […]
Functions function update($table, $columns, $conditions='', $params=array()) Sample The update() method builds and executes an UPDATE SQL statement. <?php $user=Yii::app()->db->createCommand() ->update('tbl_user', array( 'username'=>'bsourcecode', ), 'user_id=:id', array(':id'=>1)); ?> OUTPUT SQL UPDATE `tbl_user` SET `username`=:username WHERE user_id=:id