Forums

SQL DB count entries and put variable

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 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.
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
Draeke 09 Feb, 2021
Answer
COUNT(column name)
You need to login to be able to post a reply.

VPS & Email Hosting 20% discount

{item:title} {images:#}