 |
|
เพิ่งหันมาจับ php framework ก็เลยลองจับ yii หลังจากลองศึกษาแล้วค่อนข้างสับสน
รบกวนช่วยดูหน่อยครับเกิดปัญหา Call to a member function getCount() on array
Controller
Code (PHP)
public function actionIndex()
{
$sql = "SELECT * FROM orders";
$command = Yii::$app->db->createCommand($sql);
$dataProvider = $command->queryAll();
return $this->render('index', [
//'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
View
Code (PHP)
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
//'customer.name',
'id',
'price',
//'customer.type',
//'status',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
Tag : PHP, MySQL, Yii PHP Framework
|
|
 |
 |
 |
 |
Date :
2016-10-12 16:25:02 |
By :
DevilMonkeyZ |
View :
1376 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |