Display A Message If “Where” Criteria Not Met

6 posts by 2 authors in: Forums > CMS Builder
Last Post: May 12, 2010   (RSS)

Re: [gkornbluth] Display A Message If “Where” Criteria Not Met

By Jason - May 11, 2010

Hi Jerry,

I think you need to group the AND clauses in your WHERE clause. Try this:

<?php
list($e_blast_events_noticeRecords, $e_blast_events_noticeMetaData) = getRecords(array(
'tableName' => 'e_blast_events_notice',
'where' => '((NOW() + INTERVAL 7 DAY) >= event_reception_date AND event_reception_date >= TIMESTAMP(CURDATE(), "00:00:00")) OR ((NOW() + INTERVAL 7 DAY) >= event_start_date AND event_start_date >= TIMESTAMP(CURDATE(), "00:00:00"))',
'orderBy'=> 'neverRemove ASC, event_start_date ASC',
));

?>


Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Display A Message If “Where” Criteria Not Met

By gkornbluth - May 12, 2010

Sorry Jason,

That rendered the same result which you can see at http://www.artistsofpalmbeachcounty.org/events2.php

There are no records which meet the where criteria and the message says that there are matching records.

I've attached the event2.php file

Thanks,

Jerry
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:

events2.php 26K

Re: [gkornbluth] Display A Message If �Where� Criteria Not Met

By Jason - May 12, 2010

Hi Jerry,

The code you provided looks good. The so your query must be returning something.

You can take a look at exactly what is in your variable by using this code:

<?php showme($e_blast_events_noticeRecords); ?>

This will display all of the contents of the array. If you need some more help, you can email me your CMS login and FTP information to jason@interactivetools.com.

Please don't post this information to the forum.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Display A Message If �Where� Criteria Not Met

By gkornbluth - May 12, 2010

Well Jason,

<?php showme($e_blast_events_noticeRecords); ?> was the trick I should have tried before I bothered you.

Turns out that I had a field for "sponsored events" but was checking for that after the" if" statement that displayed the messages. Including the test for" sponsored events" in my "where" fixed the problem.

Valuable lesson learned.

Thanks for all your time and effort.

Best,

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

Re: [gkornbluth] Display A Message If �Where� Criteria Not Met

By Jason - May 12, 2010

Excellent! Glad that worked out.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/