SQL DB count entries and put variable

How to count database entries and use the result to conditionally disable form fields in ChronoForms.

Overview

The issue arises from not knowing where to place the SQL query code within the CF form builder to retrieve a count.
Use the 'Read Data' action with a COUNT query in the 'Query Fields' section. Then, in your HTML, reference the returned count using the provided alias to conditionally disable your input fields.

Answered
ChronoForms v7
Dr Draeke 07 Jan, 2021
Hello

I want to count certain entries from the database and deactivate input fields based on the output.
The "input" tag is not the problem. But I don´t know where I have to put the sql code (incomplete)!?
$sql = "SELECT COUNT(row) FROM db WHERE xy='yx'";
if ($result = mysqli_query($db, $sql)) {
$row = mysqli_fetch_row($result);
$count = $row[0];
<input type="radio" id="id" name="name" value="value" <?php if($count >= $int){ echo "disabled";} ?> >
Max_admin Max_admin 09 Feb, 2021
did you manage to solve this ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Dr Draeke 09 Feb, 2021
Yes!
Action -> Read Data -> Query Fields -> COUNT(radio name) and WHERE command
then
HTML with php: ... $count1 = $this->get("field alias from read data"); ...

For me the best solution
Dr Draeke 09 Feb, 2021
Answer
COUNT(column name)
This topic is locked and no more replies can be posted.