Difference between #7 and #8 of
custom sql query results to CDetailView

Revision #8 has been created by Kostas Apazidis (KonApaz) on Sep 25, 2013, 7:41:53 PM with the memo:

-
« previous (#7) next (#9) »

Changes

Title unchanged

custom sql query results to CDetailView

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

custom, sql, query, CDetailView, CSqlDataProvider, CArrayDataProvider

Content changed

[...]
----------------------------------------------------------
I show you now how to make the similar task using other Providers

**With CSqlDataProvider**

 
```php 
$sqlProvider = new CSqlDataProvider('select * from your_table');
 
$sqlProvider = $sqlProvider->getData();
 
$sqlData = $sqlProvider[0];
 
$this->widget('zii.widgets.CDetailView', array( 'data' => $sqlData, )); ```
 
**With CArrayDataProvider**
 
 
 
```php 
$connection = Yii::app()->db;
 
$command = $connection->createCommand('select * from your_table');
 
$row = $command->queryRow(); $sqlData = new CArrayDataProvider(array($row));
 
$sqlData = $sqlData->getData();
 
$sqlData = $sqlData[0];
 
$this->widget('zii.widgets.CDetailView', array( 'data' => $sqlData, ));
 
```
 
3 0
4 followers
Viewed: 45 809 times
Version: 1.1
Category: How-tos
Last updated by: Rohit Suthar
Created on: Sep 23, 2013
Last updated: 9 years ago
Update Article

Revisions

View all history