Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: Instant Website: Realty/Listings/Auto:
List in a table display

 

 


thenetgirl
User

Aug 11, 2009, 9:54 PM

Post #1 of 9 (2912 views)
Shortcut
List in a table display Can't Post

   

I am trying to make a page display by City category on a single page

I used a

<?php echo join(', ', getListLabels('vacation_rentals', 'City', $record['City'] == 'PEBBLE BEACH')); ?>

http://www.montereyrentals.com/2009/1VacationRentalsList.php

but it just lists everything over each time

HELP PLEASE

thanks


Chris
Staff


Aug 12, 2009, 11:23 AM

Post #2 of 9 (2908 views)
Shortcut
Re: [thenetgirl] List in a table display [In reply to] Can't Post

Hi thenetgirl,

Can you post the PHP source code for your page?
Chris


thenetgirl
User

Aug 12, 2009, 11:36 AM

Post #3 of 9 (2906 views)
Shortcut
Re: [chris] List in a table display [In reply to] Can't Post

Here ya go Chris
Attachments: VacationRentalsList.php (4.36 KB)


Chris
Staff


Aug 13, 2009, 12:55 PM

Post #4 of 9 (2897 views)
Shortcut
Re: [thenetgirl] List in a table display [In reply to] Can't Post

Hi thenetgirl,

To filter records during a foreach, you can skip records if the record doesn't match a certain condition.

Add the following code directly after each <?php foreach ... ?>, adjusting the city you're matching for:


Code
<?php if ($record['City'] !== "Pebble Beach") { continue; } ?>


I hope this helps! Please let us know if you have any questions or comments.

P.S. You'll want to move your foreach and endforeach outside of your <tr></tr> tags so your tables don't get messed up. For example:


Code
<table> 
<tr>
...column headers here...
</tr>
<?php foreach ... ?>
<?php if ($record['City'] !== "Pebble Beach") { continue; } ?>
<tr>
...display listing here...
</tr>
<?php endforeach ?>
</table>

Chris


(This post was edited by chris on Aug 13, 2009, 12:56 PM)


thenetgirl
User

Aug 13, 2009, 4:10 PM

Post #5 of 9 (2886 views)
Shortcut
Re: [chris] List in a table display [In reply to] Can't Post

http://www.montereyrentals.com/2009/VacationRentalsList.php

now it displays nothing

it is "Pebble Beach" with " " not ' ' right
Attachments: VacationRentalsList.php (3.83 KB)


Chris
Staff


Aug 13, 2009, 5:03 PM

Post #6 of 9 (2884 views)
Shortcut
Re: [thenetgirl] List in a table display [In reply to] Can't Post

Er, maybe that should be lowercase.

Can you try $record['city'] instead of $record['City'] please?

Yes, it won't matter if you use 'single quotes' or "double quotes" here.
Chris


thenetgirl
User

Aug 13, 2009, 5:33 PM

Post #7 of 9 (2882 views)
Shortcut
Re: [chris] List in a table display [In reply to] Can't Post

'city' gave me and error and City is correct however PEBBLE BEACH is in caps changed that still nothing

City: <?php echo join(', ', getListLabels('vacation_rentals', 'City', $record['City'])); ?>


Chris
Staff


Aug 13, 2009, 7:02 PM

Post #8 of 9 (2877 views)
Shortcut
Re: [thenetgirl] List in a table display [In reply to] Can't Post

Sorry! How did I miss that? Your City field is "multi value". I should have seen that from the start.

Please try this line instead:


Code
<?php if (!stristr($record['City'], "\t"."Pebble Beach"."\t")) { continue; } ?>

Chris


thenetgirl
User

Aug 13, 2009, 7:19 PM

Post #9 of 9 (2875 views)
Shortcut
Re: [chris] List in a table display [In reply to] Can't Post

 OMG I could jsut Kiss you SMOOOOOOOOOOOOOOOOOOCH



THANK TONS YIPPPPPPPPPPPPPIE