Jump to content

loop select records


hcdesigners

Recommended Posts

I have to select first state, then display cities, shops under that state, some times some states does not have cities. If no cities found I do not want to show that rows or city. Something life below.

 

 

Florida (field - state)

Tempa - Macys

Miami - Officemax

Okala - Staptes

 

Oklahoma (field - state)

....

.....

 

 

In this case I do not want to see Oklahoma. can some one help me please.

Thanks,

 

Link to comment
Share on other sites

Well if you're doing a foreach loop then tell it to not display for example...

 

if (!empty($game['vtn']))

 

That is just an example I used in my module to not display vtn..  I didn't want to display a zero so I used that... 

 

You can always do a, again not sure if you're looping but if you are I don't know the keys so this is just an example...

if ($games['vtn'] != "Oklahoma") 
{
show your content here... 
} 

I'm no expert but that should work....

 

You're not real specific on whether you don't ever want to show it or just one time... the above method will never show it.

Edited by cowboysdude
Link to comment
Share on other sites

Thank you for your input. Not helping. Please see below my code, very messy, not in order, I have all the way below displayed date.

Automatically I want to display country, under country state, then under state each city, population, schools, school url.. I do not want to physically code country or state like, != state, etc..

 

I tried pasting my code, I could not. Please see attachment.

 

Help me out in looping this this please.

Thank you,

----------------

 

 

 

 

 

 

phpcode-phpfreaks-loop.txt

Link to comment
Share on other sites

Since I don't look at code that is not posted here, I will offer this solution.

 

Why not build a query of what you need for your output and only select the records that meet your needs? That way you will not have any record for a state that does not have associated cities/stores.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.