Incuding two different type of information from the same table on one page

2 posts by 2 authors in: Forums > CMS Builder
Last Post: September 15, 2009   (RSS)

Re: [kevindrinkall] Incuding two different type of information from the same table on one page

By Chris - September 15, 2009 - edited: September 15, 2009

Hi kevindrinkall,

While you can't pass information to includes via new query strings, they have access to any variables that have been declared.

For example, if you already have a $releasenotesRecord variable loaded, you could call your include like this:

<?php include "inc.php"; ?>

... then in inc.php, work with the variable:

if (!$releasenotesRecord) { die('inc.php expects $releasenotesRecord to be defined'); }

list($moreReleasenotesRecords,) = getRecords(array(
'tableName' => 'releasenotes',
'perPage' => '10',
'where' => "program = '{$releasenotesRecord['program']}' and num != $releasenotesRecord['num']", // same program but different num (i.e. exclude the current record)
));


You'll want to be careful with your variable names when doing two getRecords() from the same table. It's easy to accidentally overwrite your variables.

I hope this helps, but if you're still having trouble, please post both your files as attachments and I'll have a look.
All the best,
Chris