ja ik plaats snel 2 vragen achter elkaar sorry daarvoor maar ik ben ook bezig geweest aan 'n tag systeem.
En hij blijft het niet goed doen.
--
-- Tabel structuur voor tabel `tags`
--
CREATE TABLE `tags` (
`id` int(255) NOT NULL auto_increment,
`tag` varchar(255) collate latin1_general_ci NOT NULL default '',
`aantal` int(255) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=26 ;
--
-- Gegevens worden uitgevoerd voor tabel `tags`
--
INSERT INTO `tags` (`id`, `tag`, `aantal`) VALUES
(11, 'rofl', 0),
(12, 'rofl', 0),
(13, 'rofl', 0),
(14, 'drum', 0),
(15, 'drum', 0),
(4, 'henk', 2),
(5, 'henk', 3),
(6, 'wmcity', 21),
(7, 'rofl', 1),
(8, 'rofl', 3),
(9, 'rofl', 6),
(10, 'toffolo', 634),
(16, 'rofl', 0),
(17, 'rofl', 0),
(18, 'rofl', 0),
(19, 'rofl', 0),
(20, 'rofl', 0),
(21, 'rofl', 0),
(22, 'rofl', 0),
(23, 'rofl', 0),
(24, 'rofl', 0),
(25, 'rofl', 0);
Dit is me tabel
Bestand toptags.php:
<?php
include('config.php');
$tags = mysql_query('SELECT * FROM ((SELECT tag, count(*) AS aantal FROM tags GROUP BY tag) ORDER BY aantal DESC LIMIT 4) a ORDER BY RAND()');
$totaal = mysql_query('SELECT count(*) AS aantal FROM tags');
$totaal = $totaal[0];
while($eentag = mysql_fetch_array($tags)) {
$populair = $eentag['aantal'] / $totaal;
if($populair > 0.9) {
echo "<font size=9>" . $eentag['tag'] . "</font> ";
} else if($populair > 0.5) {
echo "<font size=7>" . $eentag['tag'] . "</font> ";
} else {
echo "<font size=5>" . $eentag['tag'] . "</font> ";
}
}
?>
Die geeft deze error
Warning: Division by zero in /storage/mijndomein/users/099539/public/sites/www.**.dj-visto.eu/toptags.php on line 9
rofl
Warning: Division by zero in /storage/mijndomein/users/099539/public/sites/www.***.dj-visto.eu/toptags.php on line 9
:O
Warning: Division by zero in /storage/mijndomein/users/099539/public/sites/www.***.dj-visto.eu/toptags.php on line 9
drum
Warning: Division by zero in /storage/mijndomein/users/099539/public/sites/www.**.dj-visto.eu/toptags.php on line 9
henk
HIj geeft deze error en niet een rij met tags waar de hoogste uit worden gehaalt,
Maar alleen een random, die wordt weergeven.
Iemand die oplossing?
Alvast bedankt
Groetjes,
Vincent
knop om je tekst aan te passen.