Login | Sign up | Toll-Free: 1-800-752-0455
 
 

Forum

 

24 posts by 7 authors in: Forums > CMS Builder
Last Post: February 24, 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/

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"

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/

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"

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/

Yes the name of the variable is - "date"

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/

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()).'"',
  ));

?>

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/