<br><br><div class="gmail_quote">On Fri, Apr 9, 2010 at 10:19 PM, Neil Coghlan <span dir="ltr"><<a href="mailto:neil@esl-lounge.com">neil@esl-lounge.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div bgcolor="#ffffff">
<div><font size="2" face="Arial">I am trying to print the number of downloads a
user's attachments have produced and am 95% there. I just don't know how to
print zero if the SUM returns nothing.</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">here's what I have so far (with download count
module installed which creates file_downloads table)</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial"><?php<br>$query= "SELECT SUM(count) AS
DownloadCount<br>FROM upload<br>JOIN files <br>ON upload.fid = files.fid<br>JOIN
file_downloads<br>ON files.filepath = CONCAT( 'sites/default/files/',
file_downloads.filename )<br>WHERE (files.uid = $account->uid)";<br>$results
= db_query($query);<br>while($output = db_fetch_object($results)){<br>print
$output->DownloadCount;<br></font></div></div></blockquote><div><br>print <font size="2" face="Arial">(is_int($output->DownloadCount) && (int) </font><font size="2" face="Arial">$output->DownloadCount > 0)</font><font size="2" face="Arial"> ? </font><font size="2" face="Arial"> </font><font size="2" face="Arial">$output->DownloadCount : NICE_FAT_ZERO</font><font size="2" face="Arial">;</font><br>
<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div bgcolor="#ffffff"><div><font size="2" face="Arial">}<br>?></font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">works perfectly for those whose content have
created downloads. For those who haven't, the result is a blank space. How can I
print a nice fat "0"??</font></div>
<div><font size="2" face="Arial"></font> <br></div></div></blockquote></div><br><br clear="all"><br>-- <br>Thanks<br>Sivaji<br>