Feature records in one table using accounts table

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

By 4cdg - January 8, 2015

I have a table called equipment where multiple users add records to the database.

I would like to feature some users equipment records on a page while other users records i don;t want to include

I created a checkbox in the accounts table that says feature equipment.  When i check this i would like to be able to display all the records that user has authored in the equipment table.

so say i have 30 users and want to feature 6 users equipment listings, how would i set the filter for that.

By claire - January 9, 2015

Okay, is this in the front end or inside the CMS?

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

Claire Ryan
interactivetools.com

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

By 4cdg - January 12, 2015

in the user accounts table i have created a checkbox inside the cms called featured listings.

I have a table created called Equipment where different users have author access to enter different records they want to display on the site.

On the home page of the website we are showing around 15 random records from the equipment table.

what i wanted to be able to do is inside the cms, user accounts table was check the box i created call featured listings and on the home page of the website, only show listings authored by users who have the checkbox checked.

Right now i can show 15 random of all the listings in the equipment table, but would like to know how to limit it to only the users who are checked  featured.

so i guess this is in the front end and inside the cms....

By claire - January 12, 2015

Okay good, this is likely more simple than it seems. Can you copy the getRecords call for the 15 random records here please?

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

Claire Ryan
interactivetools.com

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

By 4cdg - January 12, 2015

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/usr/local/www/dewittslist.com/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records from 'equipment'
list($equipmentRecords, $equipmentMetaData) = getRecords(array(
'tableName' => 'equipment',
'limit' => '15',
'orderBy' => 'RAND()',
'loadUploads' => true,
'allowSearch' => false,
));

?>