Here is my script:

<?
include "includes/required.php";
do_html_header('Name Here');

$query = "select @total_items=count(id) from tececo_stats";
$query1= "select referer,count(referer)/@total_items from tececo_stats group
by referer";
$result = mysql_query($query) or die("Query failed: $query<br>" .
mysql_error());
$result1 = mysql_query($query1) or die("Query failed: $query1<br>" .
mysql_error());
$num_results = mysql_num_rows($result);
?>
<table width="500">
<?
for ($i=0; $i < $num_results; $i++)
  {
 $row = mysql_fetch_array($result1);
 echo
'<tr><td>'.$row['referer'].'</td><td>'.$row['count(referer)'].'</td></tr>';
 }
 ?>
 </table>
 <?


do_html_footer();
?>

How can I echo count(referer) ?

I currently get this error

Warning: Undefined index: count(referer) in
C:\Inetpub\TecEco_PHP\stats_interface\referer_base.php on line 16


--
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com

"Jj Harrison" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Could some one give me an idea as to what I SQL query could use to get the
> percentages of each differant colomn value.
>
> ie if this was my table:
> +-------+---+
> | name   | id |
> +-------+---+
> | foobar  | 1 |
> | foobar  | 2 |
> | foobar  | 3 |
> | barfoo  | 4 |
> +-------+---+
>
> I would get this result(Then later do stuff with it in PHP):
>
> +-------+--------+
> | name  | percent |
> +-------+--------+
> | foobar | 75        |
> | barfoo | 25        |
> +-------+--------+
>
> Thanks in advance,
>
>
> --
> JJ Harrison
> [EMAIL PROTECTED]
> www.tececo.com
>
>
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to