Custom SQL queries

4 posts by 3 authors in: Forums > CMS Builder
Last Post: June 28, 2011   (RSS)

By davidarendsen - June 24, 2011 - edited: June 24, 2011

How can I use custom SQL queries with CMS Builder?

I want to use UNION in a query, but don't know how to use it with the sql query builder.

Re: [Jason] Custom SQL queries

I'm trying to execute a query on a page that is using CMS Builder.

I need to be able to merge 2 sql queries.
Merging 2 sql queries with array_merge() doesn't get me the same results as UNION.

Re: [davidarendsen] Custom SQL queries

By Dave - June 28, 2011

Hi David,

There's no easy automated way to do that. CMSB's functions like getRecords() make it easy to do simple queries, but for a custom query with union it would be easier to just code it in straight PHP.

If the page loads viewer functions you'll already be connected to the database, so just call mysql_query(). You can use the global $TABLE_PREFIX to get CMSB's table prefix.

Hope that helps! Let me know any other questions.
Dave Edis - Senior Developer
interactivetools.com