× If you expect answers you should describe your problem and give as much information's as possible. (SQL-Structure, Template Code, Joomla Version ...) Please read this before posting: joodb.feenders.de/support.html

RESULTCOUNT

More
1 year 10 months ago #6760 by dglazeii
RESULTCOUNT was created by dglazeii
Hello,

I have a database with one of the fields with a "Yes" or "No" entry. I would like to output the count of the "Yes" entries without the need for doing a search in the catalog view.

I was thinking of using the "resultcount" command but not sure how to get this output independent of the listing in the catalog view.

Thank you for your time with this.

Doyle

Please Log in to join the conversation.

More
1 year 10 months ago - 1 year 10 months ago #6772 by dglazeii
Replied by dglazeii on topic RESULTCOUNT
So, I decided to try creating my plugin. It is not working, and not sure why. I am getting the following error. "Object of class Joomla\Database\Mysqli\MysqliDriver could not be converted to string".

The result that I am trying to get is a count of "Yes" Verifications.

<?php
// no direct access

defined('_JEXEC') or die('Restricted access');
$db = JFactory::getDbo();
$result = $db->setquery("SELECT COUNT(*) FROM `alabama_cemetery`WHERE `verification`");
{
$output .= $result;
}

This is the SQL command I am trying to run, SELECT COUNT(*) FROM `alabama_cemetery` WHERE `verification` = "Yes"

I did try this, which should give the total count of record but gives me the result of 1

<?php
// no direct access

defined('_JEXEC') or die('Restricted access');
$db = JFactory::getDbo();
$result = $db->setquery("SELECT COUNT(*) FROM `alabama_cemetery`");
{
$output .= (int) $result;
}
Last edit: 1 year 10 months ago by dglazeii.

Please Log in to join the conversation.

More
1 year 10 months ago #6773 by dglazeii
Replied by dglazeii on topic RESULTCOUNT
I was able to get this working using the

Please Log in to join the conversation.

Moderators: Dirkjoest