I am getting id's 3 times. count will be 3 but i am getting 9. i dont know where i did mistake.
any body help me
$result = mysql_query("SELECT * FROM candidate where user_id ='$username' and password='$password' and status='0' " );
$num=mysql_num_rows($result);
if($num>0)
{
$row1=mysql_fetch_array($result);
$cand_id=$row1['cand_id'];
$f_mobile=$row1['f_mobile'];
$d2=mysql_query("select * from parent where cand_id='$cand_id' and status='0'");
$row2=mysql_fetch_array($d2);
$father_name=$row2['father_name'];
$d3=mysql_query("select c.cand_id, p.cand_id as cand_id
from candidate c,parent p where c.f_mobile='$f_mobile' and p.father_name='$father_name' and c.status='0' and p.status='0' ");
$num1=mysql_num_rows($d3);
echo $num1."<br>";
if($num1>1)
{
while($row3=mysql_fetch_array($d3))
{
$cand_id=$row3['cand_id'];
echo $cand_id."<br>";
}
}
}