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 7435855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:08:40+00:00 2026-05-29T10:08:40+00:00

I am trying to create a if then statement to only display something if

  • 0

I am trying to create a if then statement to only display something if a value in a array exists.

Given two tables Address and Player I have the following relation

'displayAddress' => array(self::HAS_MANY, 'Address', 'PlayerId', 
                        'condition'=>array('IsHome=:home', 'IsWork=:wok'),
                        'params' => array(':hom'=>'Y', ':wok'=>'N')),

Now in a Player view I want to check to see if that player has any addresses where it is only their home and not their work.

I have tried setting a function for the array and checking doing isset in the view as well as in_array() and array_key_exists() but I haven’t been able to solve it.

  • 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-29T10:08:42+00:00Added an answer on May 29, 2026 at 10:08 am

    The relation you have should / will return only instances where IsHome=Y and IsWork=N. Does this work as expected? If not, try:

    ‘displayAddress’ => array(self::HAS_MANY, ‘Address’, ‘PlayerId’,
    ‘condition’=>’IsHome=:home AND IsWork=:wok’,
    ‘params’ => array(‘:hom’=>’Y’, ‘:wok’=>’N’)),

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to create an array of tm* structs, and then return them at
I'm trying to create an array in MIPS Assembly, and then add all the
I'm trying to create a widget within the module and then load that widget
In a view I'm trying to create a new user and then log them
I'm trying to create a SQL statement to find the matching record based on
I'm trying to create a INSERT statement for every row in a PHPExcel object.
I'm trying to create a trigger that monitor changes on a table and then
I tried to create a dataframe of two columns with numbers, then create a
I'm trying to create the following WHERE clause: AND CASE @SomePRarmeter WHEN 'this' THEN
I am trying create a WCF service that leverages the WPF MediaPlayer on the

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.