匹配 mysql (php) 中的电子邮件地址不起作用 - 来自 paypal iPN
度过了菜鸟的一天。
由于某种原因,这有效:
// check for user in db
$result = $connector->query('SELECT username FROM wallart_users
WHERE username ="[email protected]");
if (mysql_num_rows($result) == 0) {
////// ADD NEW USER
但这不起作用:
$payer_email = mysql_real_escape_string($payer_email);
// check for user in db
$result = $connector->query('SELECT username FROM wallart_users
WHERE username ='.$payer_email);
if (mysql_num_rows($result) == 0) {
////// NEW USER
第一个匹配并将我发送到页面的更下方。
第二个不匹配(有或没有转义),并尝试使用相同的凭据创建一个新用户(然后失败,因为该用户已经存在)。
PayPal 发送的电子邮件地址始终相同,并且数据库包含正确的地址。
我已在此过程中将两个地址写入日志文件,它们看起来相同。
Having a noob day.
For some reason this works:
// check for user in db
$result = $connector->query('SELECT username FROM wallart_users
WHERE username ="[email protected]");
if (mysql_num_rows($result) == 0) {
////// ADD NEW USER
But this doesn't:
$payer_email = mysql_real_escape_string($payer_email);
// check for user in db
$result = $connector->query('SELECT username FROM wallart_users
WHERE username ='.$payer_email);
if (mysql_num_rows($result) == 0) {
////// NEW USER
The first one matches and sends me further down the page.
The second one doesn't match (with or without the escape) and tries to create a new user with the same credentials (then fails as the user already exists).
The email address PayPal is sending is always the same, and the database contains the right address.
I have written both addresses to a log file during the process and they look identical.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这段代码
应该是
This code
Should be
您不认为您的第二个查询做错了什么吗?你应该像这样改变你的查询
Do you not think that you are doing some thing wrong with your second query? you should change your query like this