简体   繁体   English

如何使用php在mysql中找到一个字段的真实表名?

[英]How find the real table name of one field in mysql with php?

I have this query in my PHP code: 我的PHP代码中有以下查询:

SELECT usr.user_id,online.online_totime
 FROM users AS usr
 LEFT JOIN online_users AS online ON online.online_user=usr.user_id

I want to find tables in this query with PHP. 我想用PHP在此查询中找到表。 I use mysql_field_table and it returns "usr" and "online" as table names: those are not the real names. 我使用mysql_field_table ,它返回“ usr”和“ online”作为表名:这些不是真实名称。 How I can find real table names of fields? 如何找到字段的真实表名?

This query only is an example. 该查询仅是示例。 Please don't advise me not to use AS synonym . 请不要建议我不要使用AS synonym

您可以解析查询,如php.net文档的一位评论者所建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM