Posted: Thu Nov 20, 2003 3:10 pm
i think i got it without having to create a table, using some of the theory by Microthick above.
here is what i'm doing now :
*does happy hillbilly dance*
!!!!!!! EDIT !!!!!!!! WOW indeedy, check this out, a much less string of code for all this :
it hurts to be this good. 
here is what i'm doing now :
Code: Select all
<?php
$sql = "SELECT UserAgent, count(UserAgent) FROM log WHERE (UserAgent LIKE 'Mozilla/4%') Group by UserAgent HAVING count(UserAgent) > 0";
$result = mysql_query($sql) or die(MySQL_Error());
$row = mysql_fetch_assoc($result);
$Mozilla4 = $row['UserAgent'];
$Mozilla4_total = $row['count(UserAgent)'];
echo $Mozilla4_total.' '.$Mozilla4;
?>!!!!!!! EDIT !!!!!!!! WOW indeedy, check this out, a much less string of code for all this :
Code: Select all
<?php
$Mozilla = array('Netscape/7%','Mozilla/6%','Mozilla/5%','Mozilla/4%', 'NSPlayer/4%','NSPlayer/7%','NSPlayer/9%');
$Moz = array();
$Moz_total = array();
for($i=0; $i<8; $i++)
{
$sql = "SELECT UserAgent, count(UserAgent) FROM log WHERE (UserAgent LIKE '".$Mozilla[$i]."') Group by UserAgent HAVING count(UserAgent) > 0";
$result = mysql_query($sql) or die(MySQL_Error());
$row = mysql_fetch_assoc($result);
$Moz[$i] = $row['UserAgent'];
$Moz_total[$i] = $row['count(UserAgent)'];
}
for($i=0; $i<8; $i++)
{
echo $Moz_total[$i].' '.$Moz[$i];
echo '<br />';
}
?>