Database value, float to currency format

How to format values read from the database using the Read Data action in ChronoForms8.

Answered
ChronoForms v8
Pk Pkoll 15 May, 2025

Hi Max,

I have a table view from a database table where the field Contributie is a decimal (8,2) field with an value 130.00.

I wil show it like €130,00. Is that possible with an HTML or PHP function in the field? So the period must be an comma.

Greetings

Paul

Max_admin Max_admin 16 May, 2025
Answer

Hi Paul

of course, use HTML view with PHP behavior and parse then print the database field value, you may use something like this:

$price = $this->get("read_action_name.price");
$formatted = '€' . number_format($price, 2, ',', '.');
echo $formatted;

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Pk Pkoll 19 May, 2025
1 Likes

Hi Max,

I used "data" instead of "get". Now I understand why it doesn't work.

Thanks

Paul

Post a Reply