计算mysql中的行数? [英] count the number of rows in mysql?

查看:298
本文介绍了计算mysql中的行数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用php计算mysql数据库表中的行数?

How to count the number of rows in mysql database tables with php?

如果在数据库中有5行,它们的数字如下所示( bold ):

if have in database 5 rows, they number show like this(bold):



所有列为 5

1 row1
2 row2
3 row3
4 row4
5
row5

1 row1
2 row2
3 row3
4 row4
5 row5


推荐答案


我们如何计算他们在一起? LIKE:1 2 3 4 5.我不想在列数据库中使用ID

How do we count them back together? LIKE: 1 2 3 4 5. i not want use of id in column database



select list_of_fields,@rn:=@rn+1 as row_num
from table,(select @rn:=0) as r order by id

这篇关于计算mysql中的行数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆