Uploaded image for project: 'Olio'
  1. Olio
  2. OLIO-15

SQL to count friends in friends.php overly complex

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • None
    • php-app
    • None

    Description

      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.

      Attachments

        Activity

          People

            akara Akara Sucharitakul
            nick1 Nick Lanham
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m