Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6880907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:02:23+00:00 2026-05-27T05:02:23+00:00

I am developing a module in website to save and retrieve friend list. I

  • 0

I am developing a module in website to save and retrieve friend list. I am using Zend Framework and for DB handling I am using Doctrine(ORM).

There are two models:

1) users that stores all the users
2) my_friends that stores the friend list (that is reference table with M:M relation of user)

the structure of my_friends is following


…id……….user_id…………friend_id……..approved….
…10………20 ………………25……………….1……….
…10………21 ………………25……………….1……….
…10………22 ………………30……………….1……….
…10………25 ………………30……………….1……….


The Doctrine query to retrieve friend list id following

$friends = Doctrine_Query::create()->from('my_friends as mf')
                                 ->leftJoin('mf.users as friend')
                                 ->where("mf.user_id = 25")
                                 ->andWhere("mf.approved = 1");  

Suppose I am viewing the user no.- 25.
With this query I am only getting the user no.- 30.
where as user no.- 25 is also approved friend of user no.- 20 and 21.
Please guide me, what should be the query to find all friend and is there any need to change the DB structure.

YAML
Member:
columns:

id:
  primary: true
  type: integer
  notnull: true
  autoincrement: true
userName:
  unique: true
  type: string(255)
Address_id:
  type: integer(4)
MemberPhoto_id:
  type: integer
 relations:
address:
  class: Address
  local: Address_id
  foreign: id
memberPhotos:
  class: MemberThumbnail
  foreignAlias: member
  local: MemberPhoto_id
  foreign: id

refPeeps:
columns:
id:
  primary: true
  unique: true
  type: integer
  autoincrement: true
Member_id:
  type: integer
  notnull: true
Peep_id:
  type: integer
  notnull: true
relations:
Member:
  local: Member_id
  foreign: id
Member:
  local: Peep_id
  foreign: id
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:02:24+00:00Added an answer on May 27, 2026 at 5:02 am

    – Hello Amrit.

    – I think you need to fetch data with two query. According to me you have to follow these steps

    1. First get all data with join query corresponding to friend_id.
    2. And second time you apply simple query for user_id and get data.
    3. And then fetch data corresponding to the second query.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I am developing website baker's module. There is one option to upload image.
I am developing a web site using the Zend Framework. I was using this
I'm developing a statistics module for my website that will help me measure conversion
Currently I am developing website in asp.net. I wanted to include spellchecker module into
I am developing a Ecommerce website by using version Magento 1.6. I need to
I am developing a module for Python using a C API. How can I
I am developing an archive module for an application using Dotnet and SQL Server
I'm developing mobile part of website and I need recommendation for a module and
I am developing an Android application associated with a website. There is a registration
I am developing a website using VS 2008 (C#). My current mission is to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.