PHP MYSQL:以升序列出表的方法 [英] PHP MYSQL : way to list table in ascending order

查看:67
本文介绍了PHP MYSQL:以升序列出表的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用"SHOW TABLES FROM"从数据库中列出表,但是无法按顺序列出表(ORDER BY不适用于表) 还有其他安排方式吗? 我们可以用php来做到这一点吗:如果可以,请给我提示 谢谢

we use " SHOW TABLES FROM " to list tables from database but there is no way to list table in order (ORDER BY dont work with tables) is ther any other way to arrange it ?? can we do this with php :if yes please give me hint to do it thank you

推荐答案

您可以使用INFORMATION_SCHEMA:

You can use INFORMATION_SCHEMA:

SELECT table_name FROM INFORMATION_SCHEMA.TABLES
  WHERE table_schema = 'db_name'
  ORDER BY table_name ASC

参考: http://dev.mysql.com/doc/refman/5.0/en/tables-table.html

这篇关于PHP MYSQL:以升序列出表的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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