Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi there
I have put a message in forum: http://drupal.org/node/139742, requesting a way to count buddies by users, after some topics I have got this code, but it's not working correctly.
<?php
$resource = db_query('SELECT COUNT(u.uid) AS number FROM users ur LEFT JOIN buddylist u ON u.uid=ur.uid WHERE ur.status=1 AND u.received=1 AND u.uid=1 GROUP BY ur.uid');
$result = db_fetch_array($resource);
echo "You have ".$result['number']." buddies. Don't you feel special?";
?>
How can I do it?
Best