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

  • SEARCH
  • Home
  • 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 6070567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:56:54+00:00 2026-05-23T09:56:54+00:00

I think database operations isn’t explained very well, on guide . I couldn’t understand

  • 0

I think database operations isn’t explained very well, on guide . I couldn’t understand it. Because of this i have a question. I asked it Yii Forums but there isn’t any answer. This is my socials table for example.

+------------+---------------------------+--------------+--------------+---------------+
| socials_ID | socials_link              | socials_type | socials_user | socials_order |
+------------+---------------------------+--------------+--------------+---------------+
|         48 | link                      |            8 |            1 |             4 |
|         47 | blablabla                 |           11 |            1 |             3 |
|        301 | userlinkuse               |            9 |            1 |             6 |
+------------+---------------------------+--------------+--------------+---------------+

I want to get all datas from this table which socials_user collumn equals to 1 . There can be a few rows (in this example there are 3 rows) .

What method should i use ? I’m trying this :

                $allSocial = '';
                $socials=Socials::model()->findByAttributes(array('socials_user'=>1));
                foreach ($socials as $social)
                {
                        $type = $social["socials_type"];
                        $allSocial .= $type . ",";
                }
                return $allSocial;

but this is returning 4 , l , 8 ,1 , 4 . (First letter / number of every collumn on first row)

How can i use it ? findByAttributes AR is adding LIMIT 1; to SQL ?

  • 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-23T09:56:54+00:00Added an answer on May 23, 2026 at 9:56 am

    Use this method to get records from the table having socials_user column value equal to 1.

    $socials=Socials::model()->findAll('socials_user=:socials_user', array(':socials_user'=>1));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have alluded to this issue in my other question , but i think
I am trying to mock database operations. I have problem in mocking SqlParameterCollection .
I'm trying to design a database for a sports meeting. I think I've got
I have read that using database keys in a URL is a bad thing
I have a 3 table SQLServer Database. Project ProjectID ProjectName Thing ThingID ThingName ProjectThingLink
I think most people know how to do this via the GUI (right click
I think most people here understand the importance of fully automated builds. The problem
I think this is specific to IE 6.0 but... In JavaScript I add a
I am asking this out of a curiosity. Basically my question is when you
I have a database and bunch of related tables . I just want 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.