我想在我的joomla站点中触发一个复杂的查询.我已经为它写了下面的代码.
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('`chr`.`characteristic_id`,`chr`.`characteristic_value`,`prc`.`price_value`');
$query->from('`#___hikashop_product` AS `pdt`');
$query->join('inner', '`#__hikashop_variant` AS `vari` ON `pdt`.`product_id` = `vari`.`variant_characteristic_id`');
$query->join('inner', '`#__hikashop_characteristic` AS `chr` ON `vari`.`variant_characteristic_id` = `chr`.`characteristic_id`');
$query->join('inner', '`#__hikashop_price` AS `prc` ON `pdt`.`product_id` = `prc`.`price_product_id`');
$query->where('`pdt`.`product_id` = 68');
$db->setQuery($query);
Run Code Online (Sandbox Code Playgroud)
查询正在我的本地mysql中执行.任何帮助将不胜感激
我将数据导出为CSV并面临一个问题.
$data['name'] = "Test";
$data['category'] = "category1, category2, caegory3";
Run Code Online (Sandbox Code Playgroud)
当我将代码导出为CSV时,它会导出记录,但会为category1创建单独的列,为category 2创建单独的列,为category3创建单独的列.
Current Output
-------------------------------------------
| Name | Category | | |
--------------------------------------------
| TEst | category1 | category2 | category3 |
--------------------------------------------
Expected Output
------------------------------------------------------------
| Name | Category | | |
-------------------------------------------- ---------------
| TEst | category1,category2,category3 | | |
------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
我应该怎么做,以逗号分隔的字符串落在同一列?
在Laravel中,我们如何限制用户访问其他用户的数据?
我是否需要在每个路由功能中写下代码?或laravel提供中心方法?
我有一个写代码来显示一个图像列的结果.不知怎的,它给了我错误
我写了这样的代码.
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id' => 'photo-grid',
'dataProvider' => $model->search(),
//'filter' => $model,
'columns' => array(
'id',
array(
'name'=>'user_id',
'value'=>'GxHtml::valueEx($data->user)',
'filter'=>GxHtml::listDataEx(User::model()->findAllAttributes(null, true)),
),
array(
'name'=>'regulation_id',
'value'=>'GxHtml::valueEx($data->regulation)',
'filter'=>GxHtml::listDataEx(Regulation::model()->findAllAttributes(null, true)),
),
//'photo_img',
array(
'name' => 'Photo Img',
'type' => 'raw',
'value' => CHtml::image(Yii::app()->controller->createUrl('photo/loadImage', array('id'=>$model->id)),"",array('width'=>50, 'height'=>50)),
),
array(
'class' => 'CButtonColumn',
),
),
Run Code Online (Sandbox Code Playgroud)
)); ?>
任何人都可以帮我如何在CGridView中显示图像?