Keyword

Counting scritp

  • Michał
  • Michał's Avatar Topic Author
  • Offline
  • Senior Member
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?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 5 months ago #134194 by Krikor Boghossian
Replied by Krikor Boghossian on topic Counting scritp

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Michał
  • Michał's Avatar Topic Author
  • Offline
  • Senior Member
More
9 years 5 months ago #134206 by Michał
Replied by Michał on topic Counting scritp
It works but not correctly.

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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 5 months ago #134220 by Krikor Boghossian
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ł
  • Michał's Avatar Topic Author
  • Offline
  • Senior Member
More
9 years 5 months ago #134273 by Michał
Replied by Michał on topic Counting scritp
OK.
<?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
there was double " _ ". Is it correct?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 5 months ago #134318 by Krikor Boghossian
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.


Powered by Kunena Forum