Problem solved. There was too much in the above code - revised as follows:
Code:
<?php
session_start();
ob_start();
include("includes/header.php");
include("includes/messages.php");
include("includes/validate_member.php");
ini_set("include_path", "./");if($siteCode== ""){
header("Location:selectSite.php");}if($siteCode!= ""){
$site = $siteCode;}?>
<span class="error"><b>Site Statistics by Referring URL</b></span>
<?if(isset($site)){?>
<p>The following list shows the total hits and unique visitors by referring URL to the site in the
time since tracking commenced.</p>
<p>
<table width="550" cellspacing="0" cellpadding="4" class="table">
<th>Referring URL</th>
<!--<th>Percentage (%)</th>-->
<th>Hits</th>
<th>Unique</th>
<?// Count the total number of hits to the site
$res = mysql_query("SELECT referrer, COUNT(ip) AS total_hits, COUNT(DISTINCT ip) AS total_visitors FROM stats WHERE site = $site
GROUP BY referrer");
$row = mysql_fetch_array($res);while(($row= mysql_fetch_array($res))!=NULL){if($row[referrer]== "")
$row[referrer]= "Could Not Detect";?>
<tr class="text2">
<td><?=$row[referrer]?></td>
<td><?=$row[total_hits]?></td>
<td><?=$row[total_visitors]?></td>
</tr>
<?}}?>
</p>
</table>
<?php
include("includes/footer.php");?>
So, on to the next problem.
This portion of the code is not delivering what is expected:
Code:
while(($row= mysql_fetch_array($res))!=NULL){if($row[referrer]== "")
$row[referrer]= "Could Not Detect";
When HTTP_Referrer cannot detect, it is placing "//" into the table data. Tried using
Code:
while(($row= mysql_fetch_array($res))!=NULL){if($row[referrer]== "//")
$row[referrer]= "Could Not Detect";
But still no output as expected. It reports nothing for those visits.
|