- Posts: 76
COMMUNITY FORUM
Counting scritp
- Michał
- Topic Author
- Offline
- Senior Member
Less
More
9 years 5 months ago #134164
by Michał
Counting scritp was created by Michał
Hello.
Can somebody send me script-part of code that counting articles in some category?
Can somebody send me script-part of code that counting articles in some category?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 5 months ago #134194
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Counting scritp
Hello,
This post will help you: www.joomlaworks.net/forum/k2-en/35619-solved-module-which-displays-a-total-count-of-items?start=10#125991
This post will help you: www.joomlaworks.net/forum/k2-en/35619-solved-module-which-displays-a-total-count-of-items?start=10#125991
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Michał
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 76
9 years 5 months ago #134206
by Michał
Replied by Michał on topic Counting scritp
It works but not correctly.
My code:
And it shows me 8008 articles in that category. There is only 7.
My code:
<?php
$db = JFactory::getDbo();
$db->setQuery("SELECT COUNT(*) FROM #__k2_items i, #__k2_categories c WHERE i.catid = 1046 AND i.published = 1 AND i.trash = 0");
$result = $db->loadResult();
?>
<span>Total : <?php echo $result; ?></span>
And it shows me 8008 articles in that category. There is only 7.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 5 months ago #134220
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Counting scritp
Did you replace the hash with the correct table prefix?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Michał
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 76
9 years 5 months ago #134273
by Michał
Replied by Michał on topic Counting scritp
OK.
Still the same.
inthere was double " _ ". Is it correct?
<?php
$db = JFactory::getDbo();
$db->setQuery("SELECT COUNT(*) FROM fabu_k2_items i, fabu_k2_categories c WHERE i.catid = 1047 AND i.published = 1 AND i.trash = 0");
$result = $db->loadResult();
?>
<p><span>Total : <?php echo $result; ?></span></p>
Still the same.
in
fabu_k2_items
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 5 months ago #134318
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Counting scritp
It could be. The prefix is a custom thing and it could have a double (or no) underscore.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.