如何在mysql中查询具有“#”的数据在字符串? [英] How to query mysql for data that has "#" in the string?

查看:200
本文介绍了如何在mysql中查询具有“#”的数据在字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在PHP中为包含以#符号结尾的字段的mysql执行select语句时,我收到一个错误,表明它找不到表,我没有收到任何结果。如果我删除有问题的字段,一切都完美无缺:

When I do an select statement in PHP for mysql that contains fields that end in a # sign, I receive an error that indicates that it can''t find the table and I receive no results. If I remove the offending field, everything works perfectly:

展开 | 选择 | Wrap | 行号

推荐答案

哈希符号表示在php和MySQL中的注释。
The hash symbol denotes a comment in php and also MySQL.


你能发布完整的错误吗?
Can you post the complete error?


我收到的错误是:ErrorUnknown table''VNDTBL ''在字段列表中


如果#正在终止select子句并注释掉该子句的其余部分,则此错误是有意义的。没有指定表名。我的几个表中都有#'字段。有没有办法解决这个问题,没有创建视图和重命名字段?
The error I receive is: ErrorUnknown table ''VNDTBL'' in field list

This error makes sense if # is terminating the select clause and commenting out the rest of the clause. There would be no table name specified. Several of my tables have fields with #''s in them. Is there any way to accommodate this problem, short of creating a view and renaming the field?


这篇关于如何在mysql中查询具有“#”的数据在字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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