如何使用php从数据库中获取最后创建的表名
我想使用 PHP 从 MySQL 数据库获取最后创建的表名。
我也使用了查询,但我无法获得任何值。这是查询:
"select table_name from information_schema.tables where table_schema = 'databse_name' order by create_time desc limit 1"
当我使用它时,我从本地系统获取值,但没有从客户端数据库获取值。 我的查询有什么错误?
I want to get the last created table name from a MySQL database using PHP.
I also used a query, but I cant to get any value. This is the query:
"select table_name from information_schema.tables where table_schema = 'databse_name' order by create_time desc limit 1"
When I am using this I get value from local system but not get value from client's database.
What is the mistake in my query?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我理解正确,您的查询在本地计算机上可以正常工作,但在实时环境中却不能?
或许现环境中的MySQL用户访问权限不足?尝试在实时环境 MySQL 数据库中执行类似的操作:
并将
user
替换为正确的用户名,如果您连接到 localhost 外部的数据库,也可能将localhost
部分替换。If I understood correctly, your query works fine on your local machine, but in the live environment it doesn't?
Perhaps the MySQL user in the live environment has insufficient access? Try executing something like this in the live environment MySQL database:
And replace
user
to the correct user name, also perhaps thelocalhost
part if you connect to a database outside localhost.您有要访问的数据库的权限吗?
请尝试一下:
您是否得到结果,如果您没有得到您所引用的数据库的结果,那么它一定是权限问题。
Do you have permiossion for the databases you want to access?
Try this please:
Do you get a result, if you don't get a result for the database you where referring to, then it must be the permissions.