开发者

PHP Query with a multiple resoruces (results) to a one string?

Im trying to get a (multiple) results - resources actually from one Query, ready to be exploded(). I did it troughout while() command, but its quite complicated. All I need is resources.

Like "SELECT id FROM..." what are 1,2,3,4,5...

to output like this..

1,2,3,4,5

Ca开发者_StackOverflow中文版n this be done?

Thanks!


You can do it by using group_concat in your query.

SELECT group_concat(id) as id FROM....

http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat


use GROUP_CONCAT() function

see this link http://mahmudahsan.wordpress.com/2008/08/27/mysql-the-group_concat-function/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜