Status
Not open for further replies.

Chris2k

Banned
Banned
901
2009
17
0
hi

im tryna count and show sites ddl count, here is wot ihave

PHP:
           if(isset($core->siteSQL) && isset($core->siteSURL) && $core->numRows != 1) { //if site url are ok and are in db and have downloads
		   
		       $sid = mysql_query("SELECT sid FROM wcddl_sites"); 
			   
			   $getnumddls = mysql_query("SELECT COUNT (title) AS 'number' FROM wcddl_downloads WHERE sid = '$sid'");
			   $result = mysql_query($getnumddls) or die(mysql_error());

		   
               $siteinfos .= '<b>Site Downloads:</b> '.$result.'';
                }

im getting: Query was empty

any help.....
 
4 comments
Try this - not tested and I haven't used WCDDL in months.

PHP:
<?php
if(isset($core->siteSQL) && isset($core->siteSURL) && $core->numRows != 1) {
	$query_siteid = mysql_query("SELECT sid FROM wcddl_sites WHERE url = '" . $core->siteSURL . "'");
	$siteid = mysql_result($query_siteid,0);

	$query_total = mysql_query("SELECT COUNT(*) FROM wcddl_downloads WHERE sid = '" . $siteid . "'");
	$total = mysql_result($query_total,0);
	$siteinfos .= '<b>Site Downloads:</b> '.$total.'';
}

Ideally you wouldn't have to do a query to get the sid. You should have it someplace already in the script called for that page but anyway....
 
I can't remember wcddl and It's late so just replace
$siteinfos .= '<b>Site Downloads:</b> '.$total.'';

with

$siteinfos .= '<b>'.$siteid.' Site Downloads:</b> '.$total.'';


You'll get a number before the Site Downloads part and it should be the id number of the site. If your not getting that then we can find the problem easier
 
Status
Not open for further replies.
Back
Top