RE: [PHP-DB] serious help with linking data together...
| From: | Aaron Wolski | Date: | Fri, 15 Nov 2002 14:38:07 +0000 |
| Subject: | RE: [PHP-DB] serious help with linking data together... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-23370@lists.php.net to get a copy of this message | ||
By George I think I may have got it!
Code:
<HTML>
<HEAD>
</HEAD>
<link rel="stylesheet" href="styles.css" type="text/css">
<BODY>
<table border="0" cellpadding="0" cellspacing="0"
width="600">
<tr valign="top">
<td><img src="Graphics/spacer.gif" width="350"
height="1"></td>
<td><img src="Graphics/spacer.gif" width="150"
height="1"></td>
<td><img src="Graphics/spacer.gif" width="100"
height="1"></td>
</tr>
<tr valign="top">
<td class="content_bold">Keyword</td>
<td class="content_bold">Search Engine</td>
<td class="content_bold"
align="center">Count</td>
</tr>
<?php
$keyQuery = db_query("SELECT *, COUNT(keyword) as kTotal FROM
SiteTrackingTable WHERE keyword>' ' GROUP BY keyword ORDER BY kTotal
DESC");
while ($keyResult = db_fetch($keyQuery)) {
$refQuery = db_query("select referer,
COUNT(referer) as refTotal FROM SiteTrackingTable WHERE
keyword=".escapeQuote($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>
<tr valign="top">
<td colspan="3"><img src="Graphics/spacer.gif"
width="600" height="10"></td>
</tr>
<?php
}
?>
</table>
</BODY>
</HTML>
Link: http://www.rinkrake.com/blah.php
Wacha think?
Aaron