开发者

How do I echo mySQL rows separately?

I'm pulling rows from a table in the database:

title and COUNT(id) AS 'count'.

There are tw开发者_StackOverflow中文版o things that I want to accomplish. The first is being accomplished by echoing $row['title'] and $row['count'] in the same line in a WHILE loop.

The second requires some other method. I'm putting it in javascript right on the page. When I do by echoing title and count (as above), It only returns the first record. Is there a way to echo each record separately, so that each time I echo, it will get the next record?


You can use mysql_data_seek($result, 0); to return the mysql resource back to the beginning of the list. Then for your Javascript, use another while($data = mysql_fetch_assoc($result)) loop.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜