简体   繁体   English

如何在td中获取逗号分隔的值

[英]How to get comma separated values in td

i getting values from query but i have to place them as comma separated values if there is more than one value I'm looking for output like this: title (x,y) , (x,y) 我从查询中获取值,但是如果有多个值,我必须将它们放置为逗号分隔的值,而我正在寻找这样的输出:title(x,y),(x,y)

Please help me how can i do this i'm trying in function to get this 请帮我如何做到这一点我正在尝试功能

$cols = array ('test.*', 'user.*', 'count(test_stats.test_public_id) as 
past_day_views','test_stats.test_public_id', 'test_stats.*' );
$select = $db->select () ->from ( 'test', $cols )
    ->join ( 'user', 'user.user_id = test.user_id', array () )
    ->join ( 'test_stats', 'test_stats.test_public_id = test.test_public_id', array ())
    ->where ( 'test_stats.updated_on > DATE_SUB(CURDATE(), INTERVAL 1 DAY)' )
    ->group ( 'test_stats.test_public_id' )
    ->order ( 'title' );
    $result = $db->fetchAll ( $select );
foreach ( $result as $row1 ) {
    $x = $row1 ['x'] ;
    $y = $row1 ['y'];
    $z = $row1 ['title'];
}

我在查询中使用了这个

GROUP_CONCAT(DISTINCT  test_stats.xy SEPARATOR '<br/>') as x

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM