【问题标题】:How to select id using email verification如何使用电子邮件验证选择 id
【发布时间】:2023-03-19 16:03:02
【问题描述】:

我需要一个查询,所以在进入问题之前我将介绍数据库设计

 Table Name- jom_community_users

 id || name || username || email || password || usertype || block || sendEmail  
 -------------------------------------------------------------------------------
 799   aaaa    aaaa.bbbb  a@a.com   xxttxyyb   Registered     1          0  
 -------------------------------------------------------------------------------
 800   xxxx    xxxx.yyyy  x@x.com   aabbxtta   Registered     1          0       

 Table Name- jom_community_invit

 from_id || to_email || point_given
 -----------------------------------
 799       x@x.com         1 

从 jom_community_users 中选择 id

  • 此表中的 email 等于 jom_community_invit 表中的 to_email
  • 在 jom_community_invit 表中给出的分数应该是 1

【问题讨论】:

标签: php joomla joomla2.5


【解决方案1】:

不确定这是否是您所追求的,但是:

SELECT CU.id
FROM jom_community_users CU,jom_community_invit CI
WHERE CU.email = CI.to_email
AND CI.point_given = 1

如前所述,我希望这是您所要求的。

【讨论】:

  • $query = 'SELECT'。 $db->nameQuote(CU.'id') .'从 '。 $db->nameQuote('#__users'), $db->nameQuote('#__community_cinvited' CI) 。在哪里 '。 $db->nameQuote(CU.'email').'='.$db->Quote(CI.'to_email') .'AND'。 $db->nameQuote(CI.'point_given').'='.$db->Quote('1');像这样写的任何错误
  • 我觉得这里可能有问题 nameQuote('#__community_cinvited' CI) 我可以这样写CI吗
  • 嗯,我猜是这样的:$query = 'SELECT CU.id FROM jom_community_users CU,jom_community_invit CI WHERE CU.email ='.$db->nameQuote(CU.'email').' AND CI.to_email = CU.email AND CI.point_given = 1'
【解决方案2】:

你的意思是:

$query = 'SELECT cu.id FROM #__community_users cu , #__community_invit ci WHERE cu.email = ci.to_email AND ci.point_given = 1'; //OR $query = "SELECT cu.id FROM #__community_users cu JOIN #__community_invit ci ON(cu.email = ci.to_email AND ci.point_given='1') WHERE cu.email = ".$db->Quote($yourEmail); $db->setQuery( $query );

【讨论】:

    【解决方案3】:

    试试这个:

    SELECT *
    FROM #_community_users a
    INNER JOIN #_community_invit b
    ON  a.email = b.to_email where b.point_given=1
    

    【讨论】:

      【解决方案4】:

      试试看

      Select id
      from jom_community_users, jom_community_invit
      where jom_community_users.email = jom_community_invit.to_email
      and jom_community_invit.pont_given = 1
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-06-23
        • 2011-08-21
        • 2014-08-20
        • 1970-01-01
        • 2011-03-27
        • 1970-01-01
        • 2017-02-27
        • 1970-01-01
        相关资源
        最近更新 更多