匹配 mysql (php) 中的电子邮件地址不起作用 - 来自 paypal iPN

发布于 2024-11-25 14:06:51 字数 831 浏览 2 评论 0原文

度过了菜鸟的一天。

由于某种原因,这有效:

// 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

爱殇璃 2024-12-02 14:06:51
'SELECT username FROM wallart_users WHERE username ="'.$payer_email.'"';
'SELECT username FROM wallart_users WHERE username ="'.$payer_email.'"';
少跟Wǒ拽 2024-12-02 14:06:51

这段代码

$result = $connector->query('SELECT username FROM wallart_users 
WHERE username ='.$payer_email);

应该是

$result = $connector->query("SELECT username FROM wallart_users 
WHERE username ='$payer_email' ");

This code

$result = $connector->query('SELECT username FROM wallart_users 
WHERE username ='.$payer_email);

Should be

$result = $connector->query("SELECT username FROM wallart_users 
WHERE username ='$payer_email' ");
山田美奈子 2024-12-02 14:06:51

您不认为您的第二个查询做错了什么吗?你应该像这样改变你的查询

$result = $connector->query('SELECT username FROM wallart_users WHERE username ="'.$payer_email.'"');

Do you not think that you are doing some thing wrong with your second query? you should change your query like this

$result = $connector->query('SELECT username FROM wallart_users WHERE username ="'.$payer_email.'"');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文