Good day Guys… its Cindy again, I need help with a particular code am working on. I have a table in my database that is populated when old members refer new members. The table consist of the ID | Names | Referral | Status. I want the status field to show “has referral” if the person has referral or “No Referral” if the person has no referral.
++++++++++++++++++++++++++++++++++++++++
- ID + Name + Referral + Status +
++++++++++++++++++++++++++++++++++++++++ - 1 + Mike + + +
- 2 + dan + mike + +
- 3 + Sam + Mike + +
- 4 + Jude + Dan + +
- 5 + kate + Dan + +
- 6 + Bright + Kate + +
- 7 + Cole + Bright + +
- 8 + John + Cole + +
- 9 + Rick + Jude + +
++++++++++++++++++++++++++++++++++++++++
I tried this query:
[php]
$username = $name;
$query = “select * from registration where referral=’$username’”;
$run = mysql_query($query);
if(mysql_num_rows ($run)<1) {
echo "No Referral";
}
elseif(mysql_num_rows ($run)>0) {
echo "Has Referral";
}
[/php]
I was expecting to get this result
+++++++++++++++++++++++++++++++++++++++++++++++
- ID + Name + Referral + Status +
+++++++++++++++++++++++++++++++++++++++++++++++ - 1 + Mike + + Has Referral +
- 2 + dan + mike + Has Referral +
- 3 + sam + Mike + No Referral +
- 4 + Jude + Dan + Has Referral +
- 5 + kate + Dan + Has Referral +
- 6 + Bright + Kate + Has Referral +
- 7 + Cole + Bright + Has Referral +
- 8 + John + Cole + No Referral +
- 9 + Rick + Jude + No Referral +
+++++++++++++++++++++++++++++++++++++++++++++++
but what am getting is this
+++++++++++++++++++++++++++++++++++++++++++++++
- ID + Name + Referral + Status +
+++++++++++++++++++++++++++++++++++++++++++++++ - 1 + Mike + + Has Referral +
- 2 + dan + mike + Has Referral +
- 4 + Jude + Dan + Has Referral +
- 9 + Rick + Jude + No Referral +
+++++++++++++++++++++++++++++++++++++++++++++++
So this is my challenge. It seems to be omitting some. Somebody please help me!