如何使用电子邮件验证选择ID

时间:2012-03-09 07:08:24

标签: php joomla joomla2.5

我需要一个查询,所以在提出问题之前我会介绍数据库设计

 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

  • 此表中的电子邮件等于jom_community_invit表中的to_email
  • 给出的点应该是jom_community_invit表中的一个

4 个答案:

答案 0 :(得分:0)

你的意思是:


$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 );

答案 1 :(得分:0)

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

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

如上所述,我希望这就是你所要求的。

答案 2 :(得分:0)

试试这个:

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

答案 3 :(得分:0)

试试吧

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