Please help me in my problem I am searching this topic all over the internet and still i don't have the luck. to solve my problem.. .. ...
So this the situation, I have 3 table 1 is organization.tbl
, 2 is candidates.tbl
, and 3 is voters.tbl
so if the voters register and select 1 of the organization it uses that id
of organization. so If the admin create the candidates and insert the organization that the same voters have.
I already created a column that has relationship with organization.tbl, candidates.tbl, voters.tbl and the org_id of candidates.tbl and voters.tbl is unique
my question is How to create query in php. ? If the org_id
of voters is equal to org_id
of candidates.tbl ?
this is my sample query for displaying the candidates
$result = mysql_query("SELECT * FROM candidates INNER JOIN voters On voters.org_id = candidates.org_id WHERE position='President' ");
and this is for the voters log in
$login_query=mysql_query("SELECT * FROM voters INNER JOIN candidates On candidates.org_id = voters.org_id
WHERE id_number='$id_number' and password='$password' and status='Unvoted'")or die(mysql_error());