How to open CMSB DB twice?

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 27, 2010   (RSS)

Re: [mingyq] How to open CMSB DB twice?

By Jason - July 27, 2010

Hi,

You actually don't have to worry about connecting to the database as CMS Builder can handle that for you. At the top of your page should be a line of code that looks something like this:

<?php require_once("cmsAdmin/lib/viewer_functions.php"):?>

This will handle all of your database connections. There are also functions that will handle your SQL statements. The function is called getRecords. The code would look something like this:

list($listingsRecords,$listingsMetaData)=getRecords(array(
'tableName' => 'listings',
'orderBy' => 'product asc',
));


After this code is executed, $listingRecords will be an array of all of the records from the listings table, sorted by product.

For more information on this function, see this page:
http://www.interactivetools.com/docs/cmsbuilder/viewer_options.html

Hope this helps get you started. A good thing to try is to use the code generator inside CMS Builder. This will give you some great examples of the functions available in CMS Builder and how to use them.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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