Welcome to our Documentation
All
Print

Custom SQL query

This feature allows you to display table and its fields data from any table of WP database or External databases on the front-end.

Custom SQL query

Here you can enter the title of the table (you can change it later).

And click “Create table“, after which the table will be created and you can proceed to set up the query.

 SQL query

Database. Now select from which database you want to get the data for the table.

*If you are using an external database, enter the host, name, login, and password of the database.

External Database

Table. Leave the choice on SQL query to make the query manually. Or you can select the table as a data source.

If one of the tables is selected, then you can select the fields (Only the selected fields will be used to build the table.) and set unique fields, or several. (Needed to save editable fields.)

After entering unique fields, you can make changes to them directly in the table. In this case, no changes will be made to the database, only to the current table. In order for changes to be made to the database itself, the option to save the frontend field must be enabled. (options->frontend fields)

Sql select table

SQL query. If the SQL query is selected in the “table” parameter, then you can set the SQL query using the classic SQL syntax. Next, enter the SQL query in the field. You can use variables whose values are specified in the shortcode. Variables must begin with ‘SQL’, be enclosed in {} and can contain only Latin characters, digits and underscore character, for example, {sql1} or {sql_id}.

After you have selected the necessary parameters and specified the SQL query, click Go.

For example, here is the same query that we asked in the previous screenshot when selecting a table and fields manually, only using a SQL query: SELECT ID, post_author, post_title, post_date FROM wpy4_posts

Select from where

As we mentioned earlier, in order to introduce variables it is necessary that variables must begin with ‘SQL’, be enclosed in {} and can contain only Latin characters, digits, and underscore characters, for example, {sql1} or {sql_id}.

For example, let’s include a variable in our SQL query to display posts whose is id <4 and whose post type is page.

Variable sql query

Now the data table will be populated according to the SQL query and you can start setting options just like you would with a manually created data table.

Options
Shopping Cart