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)

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 [:)]