How do I display records from just 1 specific region

5 posts by 2 authors in: Forums > CMS Builder
Last Post: May 28, 2008   (RSS)

By Mel - May 26, 2008

Hi,

I have a section(table) called bios which has 15 fields in, one of these fields is called 'region'

In this section will be xxx number of records some will be for north west some will be for south east some will be for south west and so on and so forth

Two part question:

Q1. How do I get a page called lets say northwestDetails.php to display records from the bios section to display records for just one specific region for example 'north west'

Q2. When the records do display I only want three fields to display alongside a thumbnail image and when you click on either the image or a piece of text called ' click here for full details' you get to see the full record

Thanks Mel

Re: [mel] How do I display records from just 1 specific region

By Dave - May 26, 2008

Hi Mel,

To show only record from a specific region you can use a MySQL Where query like this: region = "north west"

You can either enter that in the code generator (at the bottom under "Filter Results") or in the viewer code like this:

list($records, $recordMetaData) = getRecords(array(
'tableName' => 'bios',
'perPage' => 5,
'where' => 'region = "north west"',
));


And to only display 3 fields just remove all the <?php echo ... ?> tags for the fields you don't want displayed and copy the <a href=""> tag around your image as well.

Hope that helps. Let me know if you need more details or help with that.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] How do I display records from just 1 specific region

By Mel - May 26, 2008

Hi Mel,

To show only record from a specific region you can use a MySQL Where query like this: region = "north west"

You can either enter that in the code generator (at the bottom under "Filter Results") or in the viewer code like this:

list($records, $recordMetaData) = getRecords(array(
'tableName' => 'bios',
'perPage' => 5,
'where' => 'region = "north west"',
));


And to only display 3 fields just remove all the <?php echo ... ?> tags for the fields you don't want displayed and copy the <a href=""> tag around your image as well.

Hope that helps. Let me know if you need more details or help with that.


Hi Dave,

Yes have just been experimenting with the where clause but was getting the syntax wrong now from your example I see where I was going wrong - so all records from north west are now showing great stuff [:)]

And understand about about stripping out all unrequired echo statements

But how do I get these mini listings to link to the actual full individual records?

Thanks Mel

Re: [mel] How do I display records from just 1 specific region

By Dave - May 26, 2008

Usually the code generator will create a link tag like this for you:

<a href="<?php echo $newsRecord['_link'] ?>">detail page</a>

Note that $newsRecord will be named after your table and have a different name. Try pasting the _link tag back in if you've removed it or attach your viewer file to this thread and I'll tell you what to add if you're not sure.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] How do I display records from just 1 specific region

By Mel - May 28, 2008

Thanks Dave,

All working like a treat

Mel [:)]