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: [davidarendsen] Custom SQL queries

By Jason - June 24, 2011

Hi,

Are you trying to execute a query inside CMS Builder, or on a page that is using CMS Builder?

If you want to be able to test queries on your database from inside CMS Builder, we have a free MySQL Console plugin:
http://www.interactivetools.com/add-ons/detail.php?MySQL-Console-1011

If you can provide some more information about what you're trying to accomplish, we should be able to make some suggestions.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

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