i have 3 tables in a database:
customer
contacts
reseller
my url has index.php?rid=5 (rid=5 is a row from the reseller table with a sequence of 5)
my customer table has a resellerid column so there are many rows there with a resellerid of 5
my contacts table has a company_sequence column that links to the sequence column of the customer table.
the contacts table has an email and password column
im trying to make a login form for rows form the contacts table to login using the email and password.
ive tried this code:
$sql="SELECT * from customer where resellerid = '".$ResellerID."' ";
$rs=mysql_query($sql,$conn);
while($result=mysql_fetch_array($rs))
{
$sql2="select * from contacts where company_sequence = '".$result["sequence"]."' and email='".$email."' and password='".md5($password)."'";
$rs2=mysql_query($sql2,$conn);
$result2=mysql_fetch_array($rs2);
but when i run if(mysql_num_rows($rs2) > 0) it will only check the last row even if there is a valid row in the contacts table.
how can i get this working?