Count how many entry in table

Qbik 01 Sep, 2011
I know that this is easy but maybe someone can make it in easier way😉

in footer i add this
<p style="padding-top:10px;">	<?php

        	$sql = "SELECT COUNT(cf_id) FROM jos_chronoforms_YourTable;";

	$result = mysql_query($sql);

	if(!$result) {

		$err=mysql_error();

		print $err;

		ob_clean();

		exit();

	}echo("All reservations:". mysql_result($result, 0) . "  ");

	$sql = "SELECT SUM(cf_id) FROM jos_chronoforms_YourTable;";

	$result = mysql_query($sql);

	if(!$result) {

		$err=mysql_error();

		print $err;

		ob_clean();

		exit();

	}?>


is there any way to chceck this without writing table name?
GreyHead 01 Sep, 2011
Hi Qbik,

I don't see how you could do it without writing the table name???

Bob
Qbik 27 Apr, 2012
ok and another question about that is there any option to count entry in table in new CC for J2.5?

i can Use my code but where to put it?😟
Max_admin 27 Apr, 2012
Hi Qbik,

Try
count($table_data);
?

This may not be valid in future versions though, a new method may be needed.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Qbik 27 Apr, 2012
Ok great i will try it but can you tell me where to put it?
Max_admin 27 Apr, 2012
if it works then it should work in any custom list box, header, body or footer.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Qbik 28 Apr, 2012
ok but i set Auto Listing to yes so to add this "count" stuff i have to disable it yes?
there is no other option to add this?
Max_admin 23 May, 2012
Hi Qbik,

Sorry for the late answer, well, you may try to use the "Task Control" to do that, but I'm not sure if it will work, there may be other ways, but they may be testable after the new version hopefully this week, so please contact me again after you install the new version🙂

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
vales 26 May, 2012
I added after line 902 of components \ com_chronoconnectivity \ libraries \ chronoconnection.php the statement global $ total

	function list_records($where = '', $first = false, $limited = false, $disable_hierarchies = false){
		global $total;



and you can call in header, body, footer with
<?php
global $ total;
echo $total;
?>


works well
Qbik 26 May, 2012
ok great but this work only when Auto Listing is set to "no" right?

any solution for Auto Listing set to yes?
Max_admin 31 May, 2012
Hi,

In the new V4 RC3, I think that you can do it this way:

#1- setup a task control for the "list data", add the form event name which has the "ChronoConnectivity task" action, and add the action's order number (don't configure the task in Chronoforms).

#2- add a "Custom code" action before the "ChronoConnctivity task" and enter the code below:

<?php
$MyConnection =& CFChronoConnection::getInstance("Connection_NAME");
$MyConnection->list_records();
echo $MyConnection->pageNav->total;
?>


That should output the record count above the list.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Qbik 12 Oct, 2012
It take me a long time but i tried one more time and i dont know how to set this corectly can You help me with that?
I can send you mine CC - exported table

Or you can write exactly where to write what

E.g. In front editing tab

Ok I understand that I have to add ChronoConnectivity task (but what is that exactly)
List data task control


Can You write me step by step how to set this, thx in advance
Max_admin 17 Oct, 2012
Hi Qbik,

There is a simple tutorial on task control on our FAQs page, if its hard, then you may simply run a custom count query on the list page and echo the total result.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.