Php 比较mysql中的字符串

Php 比较mysql中的字符串,php,mysql,wordpress,Php,Mysql,Wordpress,我试图比较mysql中的url,但查询返回与任何url匹配的结果 这是我的问题 SELECT a.comment_ID, a.comment_post_ID, a.comment_content, a.comment_date_gmt, a.comment_author_url, b.post_title, b.ID FROM `wp_comments` a, `wp_posts` b WHERE a.comment_post_ID

我试图比较mysql中的url,但查询返回与任何url匹配的结果

这是我的问题

SELECT
  a.comment_ID, 
  a.comment_post_ID, 
  a.comment_content, 
  a.comment_date_gmt,  
  a.comment_author_url, 
  b.post_title, b.ID
 FROM 
   `wp_comments` a, 
   `wp_posts` b
 WHERE 
   a.comment_post_ID = b.ID
  AND 
   ('a.comment_author_email' = '$email'
   OR 
    'a.comment_author_url' = '$url')
  AND a.comment_approved = 1
 GROUP BY a.comment_ID
 ORDER BY a.comment_ID DESC
谢谢


编辑:

在查询中,确保将所有的“单引号”字符替换为“反勾号字符”。

提示:

删除php变量周围的 写回勾号“围绕表属性而不是” 可能是使用内部连接可以使事情更容易 试试这个

$qry = " SELECT { watever} FROM  `wp_comments` a,
         INNER JOIN  `wp_posts` b ON `a`.`comment_post_ID` = `b`.`ID`
         WHERE
              `a`.`comment_author_email` = '".$email."'   
          OR  `a`.`comment_author_url` ='". $url."'     
         GROUP BY `a`.`comment_ID`
         ORDER BY `a`.`comment_ID` DESC "; 

考虑修改这个条件,“A.CytNuthAuthopEmail”=“$email”或“A.CytNujAudioURL”=“$URL”,这对于作者的电子邮件或提供的URL都是真实的。您传递的是什么值?如果可能,请向我们发送带有值而不是变量的查询,这将使帮助更容易=这里几乎是完整的代码。。。同样的结果。只返回注释\u author\u url中包含url的任何行:/