Re: serious help with linking data together...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Right, ok, I understand your code.  What's wrong?

On Thu, 14 Nov 2002, Aaron Wolski wrote:

> I am creating a Search Engine Tracking Report that lists keywords and
> the Search Engines used on that keyword along with the count total for
> that search Engine - example:
>
>
> Keyword			Search Engine			Count
> Web hosting			Yahoo               27
>         				Google              20
>                       MSN                 12
> Web Design			Overture            30
> 				        MSN                 17
> So on and so forth.
> Seems simple right? But nooooo not for me!
> <?php
>
> $keyQuery = db_query("SELECT keyword, COUNT(keyword) as kTotal
>        FROM SiteTrackingTable WHERE $query GROUP BY keyword");
> while ($keyResult = db_fetch($keyQuery)) {
>   if (strlen($keyResult[keyword]) > 2) {
> 		$refQuery = db_query("SELECT *, COUNT(referer)
>           as refTotal FROM SiteTrackingTable WHERE keyword=".$keyResult[keyword]."
>           GROUP BY referer ORDER BY refTotal DESC");
> 		$nrows = db_numrows($refQuery);
>       ?>
>       <tr valign="top">
>       <td class="content2"><?php echo $keyResult[keyword]; ?></td>
>       <td colspan="2">
>       <table border="0" cellpadding="0" cellspacing="0" width="250">
>       <tr valign="top">
>       <td><img src="../Graphics/spacer.gif"  width="150" height="1"></td>
>       <td><img src="../Graphics/spacer.gif"  width="100" height="1"></td>
>       </tr>
>       <?php
>         while ($refResult = db_fetch($refQuery)) { > ?>
>         <tr valign="top">
>         <td class="content2"><?php echo $refResult[referer]; ?></td>
>         <td class="content2" align="center"><?php echo $refResult[refTotal];?></td>
>         </tr>
>         <?php
>       } ?>
>       </table>
>       </td>
>       </tr>
>       <?php
> 		}
> 	}
> ?>

---------------------------------------------------------------------------
Peter Beckman            Systems Engineer, Fairfax Cable Access Corporation
beckman@purplecow.com                             http://www.purplecow.com/
---------------------------------------------------------------------------


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux