Select 语句在行值中看不到 @ 后面的字符
很奇怪的问题。将电子邮件地址保存到我的数据库中,但是当我查询这些电子邮件地址时,它显示为 name@ 而不是 [电子邮件受保护]。我怀疑正在进行一些内部过滤,但不知道如何解决。
CREATE TABLE `bredeschool`.`users` (
`userID` smallint(6) NOT NULL AUTO_INCREMENT,
`gebruikersnaam` varchar(10) NOT NULL,
`wachtwoord` varchar(10) NOT NULL,
`type` varchar(20) NOT NULL,
`aanmaakDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`wijzigingsDatum` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`userID`),
UNIQUE KEY `userID` (`userID`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
INSERT INTO users (gebruikersnaam, wachtwoord, type, aanmaakdatum, wijzigingsdatum) VALUES ('[email protected]', 'xxxx', 'ouder', '2010-06-25 15:16:40', '2010-06-25 15:16:40');
SELECT * FROM users WHERE gebruikersnaam = '[email protected]';
最后一次查询没有产生结果。不带 WHERE 执行会将电子邮件地址显示为 name@。
谢谢, 克里斯
Very weird problem. Saving email addresses to my database, but when I query those emailaddresses it shows up as name@ instead of [email protected]. I suspect some internal filtering going on but have no idea how to solve it.
CREATE TABLE `bredeschool`.`users` (
`userID` smallint(6) NOT NULL AUTO_INCREMENT,
`gebruikersnaam` varchar(10) NOT NULL,
`wachtwoord` varchar(10) NOT NULL,
`type` varchar(20) NOT NULL,
`aanmaakDatum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`wijzigingsDatum` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`userID`),
UNIQUE KEY `userID` (`userID`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
INSERT INTO users (gebruikersnaam, wachtwoord, type, aanmaakdatum, wijzigingsdatum) VALUES ('[email protected]', 'xxxx', 'ouder', '2010-06-25 15:16:40', '2010-06-25 15:16:40');
SELECT * FROM users WHERE gebruikersnaam = '[email protected]';
The last query does not yield a result. Executing without WHERE shows the emailaddress as name@.
Thanx,
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不确定插入问题,但您要搜索的电子邮件地址有 16 个字符,而 varchar 字段“gebruikersnaam”只有 10 个字符宽。可能只是您的表定义不够宽,无法存储您尝试放入其中的数据。
not sure about the insert issue, but the email address you're searching for is 16 characters, and the varchar field 'gebruikersnaam' is only 10 characters wide. It may be just that your table definition isn't wide enough to store the data you are trying to put in it.
该问题似乎与
varchar
的大小有关。尝试使用varchar(100)
作为gebruikersnaam
字段。最后一个查询现在产生结果:
The problem appears to be related to the size of the
varchar
. Try usingvarchar(100)
for thegebruikersnaam
field.The last query yields a result now:
发生这种情况可能是因为您的
gebruikersnaam
列长度太短。我认为你应该将其更改为VarChar (50)
That is happening probably because your
gebruikersnaam
column is too short in length. I think you should change it toVarChar (50)