try that one:
PHP Code:
<?php
require_once('./global.php');
$smilie_counts = array();
$posts = $DB_site->query("
SELECT smilietext, pagetext
FROM post, smilie
WHERE pagetext like concat('%', smilie.smilietext, '%')
");
while ($post = $DB_site->fetch_array($posts))
{
$smilie_counts["$post[smilietext]"] += substr_count($post['pagetext'], $post['smilietext']);
}
$output = '';
foreach ($smilie_counts AS $name => $val)
{
$output .= $name . ' -> ' . $val . '<br />';
}
print_output($output);
?>