Displaying result from a SQL query in a front end form

GraemeMS 07 Jul, 2025

Hi

Have created a form and inserted a read from database action, within this I have a put a SQL query to sum a column of prices. 

What I want to do is then display the result. I've added test box and tried and display the result, but no result is displayed.

I've looked through forum and elsewhere for some examples of how to do this, the above is just how I thought it might work without having to enter any PHP code. 

Any advice appreciated.

Regards

GMS

GraemeMS 07 Jul, 2025

Hi Max

Thank for the quick response. I have seen this page before. I might be wrong, but it's expect all the data to be displayed to come from the DB.

Whereas what I am trying to do is execute an SQL query as part of the read db action (SQL query is summing price fields from the DB to create a total e.g creating the result on the fly to then populate the form. I don't see any SQL query in the tutorial).

Apologies, fairly new to this, so what I might be trying to do, whilst seems to be to logical to me, might not be who to actually go about this..

Regards 

Max_admin 07 Jul, 2025

You do not need a custom SQL if you need to add a sum field, you can use the Fields behavior to add your fields to the fields list:

Displaying result from a SQL query in a front end form image 1

And the Group By behavior to group by the table primary key

Let me know if this does not work

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GraemeMS 07 Jul, 2025

Hi Max

I updated the Read Data action

Displaying result from a SQL query in a front end form image 2

But it has the follow error:

Displaying result from a SQL query in a front end form image 3

Graeme

Max_admin 09 Jul, 2025

Hi Graeme

This requires a code fix available in the next update.

What is your deadline for the form ?

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GraemeMS 09 Jul, 2025

Hi Max

Thanks for the reply. Not super urgent, I've actually got it to work with with a SQL query.

Regards

Graeme 

You need to login to be able to post a reply.