List upcoming events only

24 posts by 7 authors in: Forums > CMS Builder
Last Post: February 24, 2015   (RSS)

By claire - February 16, 2015

I'm afraid I can't provide an accurate where clause unless I know more about how your sections are structured, sorry.

--------------------

Claire Ryan
interactivetools.com

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

By proba - February 16, 2015

For now it is:

<?php
  require_once "........./lib/viewer_functions.php";

  list($afishRecords, $afishMetaData) = getRecords(array(
    'tableName'   => 'afish',
    'where' => 'date <= ((NOW() + INTERVAL 7 DAY) AND date >= NOW()',
  ));

?>

with foreach:

<?php foreach ($afishRecords as $record): ?><section>
            <header>
                <h1 style="width:90%;"><span style="font-size:12px;"><?php echo date("d.m.Y", strtotime($record['date'])) ?></span><br /><?php echo $record['title'] ?></h1>
            </header>
            <div class="content" style="width:100%;">
            <?php echo $record['content'] ?>
            </div>
        </section><?php endforeach ?>

and got this error - "MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY dragSortOrder' at line 4"

By claire - February 17, 2015

Okay, change your query to this:

<?php
  require_once "........./lib/viewer_functions.php";

  list($afishRecords, $afishMetaData) = getRecords(array(
    'tableName'   => 'afish',
    'addSelectExpr' => 'date <= ((NOW() + INTERVAL 7 DAY) AND date >= NOW()',
  ));

?>

--------------------

Claire Ryan
interactivetools.com

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

By proba - February 17, 2015

Ok now i got this error - "MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM `cms_afish` as `afish` ORDER BY dragSortOrder, date ASC' at line 2"

By claire - February 17, 2015

Can I confirm what the name of your date variable is, please?

--------------------

Claire Ryan
interactivetools.com

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

By wevolutions - February 19, 2015

Here is my coding:

<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */
require_once "/home/tcfs/public_html/cmsAdmin/lib/viewer_functions.php";

list($featured_carsRecords, $featured_carsMetaData) = getRecords(array(
'tableName' => 'featured_cars',
'perPage' => '30',
'orderBy' => 'main_id DESC',
));

?>

I want to show all listings from the current date to 7 days in the past please.

By claire - February 19, 2015

Okay, you can try a different version of this:

<?php
  require_once "........./lib/viewer_functions.php";

  list($afishRecords, $afishMetaData) = getRecords(array(
    'tableName'   => 'afish',
    'where' => 'date <= "'.date('Y-m-d H:i:s', time()+(60x60x24x7)).'" AND date >= "'.date('Y-m-d H:i:s', time()).'"',
  ));

?>

--------------------

Claire Ryan
interactivetools.com

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

By proba - February 24, 2015

this code have syntax error in "where"

<?php
  require_once "........./lib/viewer_functions.php";

  list($afishRecords, $afishMetaData) = getRecords(array(
    'tableName'   => 'afish',
    'where' => 'date <= "'.date('Y-m-d H:i:s', time()+(60x60x24x7)).'" AND date >= "'.date('Y-m-d H:i:s', time()).'"',
  ));

?>

By claire - February 24, 2015

What's the syntax error, please?

--------------------

Claire Ryan
interactivetools.com

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