Restricting $query results to field value passed at end of URL

6 posts by 2 authors in: Forums > CMS Builder
Last Post: October 31, 2013   (RSS)

By Dave - October 30, 2013

Hi Jerry,

Can you provide some more details?  For example, what format of URL would you like to use and what records do you want it to pull up from the database? 

Let me know and I'll try to help.  Thanks!

Dave Edis - Senior Developer
interactivetools.com

Hi Dave,

Thanks for looking at this.

I’m not explaining it very well.

If you go to http://www.terrerybovich.com/blog.php you'll see that I’ve hidden the post records from October 2013 and they don’t appear in the blog itself.

However, they appear in the Archive list and I’d like any hidden records not to.

Hope that makes more sense.

I’ve attached the code for blog.php

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Attachments:

blog_002.php 9K

By Dave - October 31, 2013

Hi Jerry,

Ok, so let me see if I understand correctly.  You want to display a list of available months under "Archives" but not if that month doesn't contain any visible articles?

If so, I'd try adding the code in red to your query: 

FROM cms_blog WHERE `hidden` = 0 GROUP BY dateAndYear

Hope that helps!  Let me know if it works for you.  Thanks!

Dave Edis - Senior Developer
interactivetools.com

Hi Dave,

Thank you, it certainly does work.

I had no idea how to add a where statement to the existing code and all of my attempts resulted in errors.

Really appreciate the help.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Dave - October 31, 2013

Hi Jerry,

Ok, glad to hear it's working.   Yes, SQL is it's own language with a very strict grammar, it can be tricky to know what goes where!

Cheers!

Dave Edis - Senior Developer
interactivetools.com