Forums

How to display the following query

angelmorales 01 Jul, 2015
Please help how can I display the result of this query:

SELECT COUNT( * ) 
FROM k1nuf_chronoengine_chronoforms_datatable_Registro_llamadas
WHERE created >= CURDATE( ) 
AND user_id =68


Thanks for your help
angelmorales 01 Jul, 2015
Still waiting for an answer

Thanks
GreyHead 02 Jul, 2015
Hi angelmorales,

Where do you want to display it? If it's just once you can add the query to the Header box of your listing.

Bob
angelmorales 02 Jul, 2015
I would like to display the line of the results (image 1 instead Pedro Martinez)
I put the query in the Header box without a result (image 2)
Thanks for your answer
GreyHead 03 Jul, 2015
Answer
Hi angelmorales,

Sorry but I don't know what you mean by "I would like to display the line of the results"?

You can't just paste a MySQL query in the Header box and expect it to do anything - it will just be treated as plain text and displayed.
<?php
$db = JFactory::getDBO();
$query = "
  SELECT COUNT( * ) 
    FROM `#__chronoengine_chronoforms_datatable_Registro_llamadas`
      WHERE `created` >= CURDATE() AND `user_id` = 68 ;
";
$db->setQuery($query);
$count = $db->loadResult();
echo $count;
?>

Bob
angelmorales 03 Jul, 2015
Hello, I mean "I would like to display IN the line of the results".
I put your code but nothing happens.
GreyHead 04 Jul, 2015
Hi angelmorales,

What happens if you test the query in PHPMyAdmin?

There is nothing in the query that changes from row to row so how does it help to display the result in each row??

Bob
angelmorales 07 Jul, 2015
Hello , i test the query and works fine, i resolve my problem with "sourcerer" its a plugin that helps to display php code in a module or and article
Thanks for your help 😀
This topic is locked and no more replies can be posted.