SQL to count friends in friends.php overly complex
--------------------------------------------------
Key: OLIO-15
URL: https://issues.apache.org/jira/browse/OLIO-15
Project: Olio
Issue Type: Bug
Components: php-app
Reporter: Nick Lanham
Assignee: Shanti Subramanyam
Priority: Minor
In public_html/friends.php:60 there's the following query:
$query = "select count(*) as count from PERSON as p, PERSON_PERSON as pp where
pp.person_username='$user' and p.username=pp.friends_username and
pp.is_accepted=1";
This simply counts the # of friends you have and could just as well be written
as:
$query = "select count(*) as count from PERSON_PERSON as pp where
pp.person_username='$user' and pp.is_accepted=1";
The only difference here would be if a person got deleted from the PERSON table
but not from the PERSON_PERSON table which should never happen.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.