<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Cast it as an integer:<br>
<br>
<font size="2" face="Arial">print (int) $output-&gt;DownloadCount;</font><br>
<pre class="moz-signature" cols="72">Jamie Holly
<a class="moz-txt-link-freetext" href="http://www.intoxination.net">http://www.intoxination.net</a> 
<a class="moz-txt-link-freetext" href="http://www.hollyit.net">http://www.hollyit.net</a></pre>
<br>
On 4/9/2010 12:49 PM, Neil Coghlan wrote:
<blockquote cite="mid:5DB08701C0F54B42BD24644922E311F5@Neil" type="cite">
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
  <meta name="GENERATOR" content="MSHTML 8.00.6001.18876">
  <style></style>
  <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>&nbsp;</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>&nbsp;</div>
  <div><font size="2" face="Arial">&lt;?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-&gt;uid)";<br>
$results = db_query($query);<br>
while($output = db_fetch_object($results)){<br>
print $output-&gt;DownloadCount;<br>
}<br>
?&gt;</font></div>
  <div>&nbsp;</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>&nbsp;</div>
  <div><font size="2" face="Arial">regards<br>
  <br>
Neil</font></div>
</blockquote>
</body>
</html>