Hallo,
ich hab hier eine SQL abfrage die funktioniert auch nur möchte das es einfach weniger Queries gibt könnte da bitte mal einer Drübersehen und mir helfen?
Danke
vielen Dank
ich hab hier eine SQL abfrage die funktioniert auch nur möchte das es einfach weniger Queries gibt könnte da bitte mal einer Drübersehen und mir helfen?
Danke
PHP-Code:
// Zufalls Addon
$content .= "<fieldset class='fieldset' style='margin:0px 0px 0px 0px'>
<legend><strong>Zufalls Addon</strong></legend><b></b><br>";
$content .= "<table width=\"97%\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
$dlcontent = $DB->query('SELECT * FROM ibf_files WHERE open=1 ORDER by rand() LIMIT 0,1');
while ($content6top = $DB->fetch_row($dlcontent)) {
$content .= "<tr><td valign=\"top\"><div align=\"center\"><iframe frameborder=\"0\" align=\"center\" scrolling=\"no\"
src=\"http://www.ibaddon.de/ipb/html/db/screens/{$content6top['screenshot']}\" vspace=\"0\"
framespacing=\"0\" alt=\"{$content6top['sname']}\" hspace=\"0\" height=\"150\" width=\"200\"></iframe></div></td></tr><tr>";
$content .= "<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"4%\" valign=\"top\">Name:</td><td width=\"96%\">{$content6top['sname']}</td>";
$content .= "</tr><tr><td valign=\"top\">Autor:</td><td>
<a href=\"".$this->base_url."index.php?showuser={$content6top['mid']}\">{$content6top['author']}</a> </td></tr><tr>
<td colspan=\"2\"><div align=\"center\">[ <a href=\"".$this->base_url."index.php?download={$content6top['id']}\">Download</a> ] </div></td></tr></table></td>";
}
$content .= "</tr></table></fieldset>";
$content .= "<br><br><fieldset class='fieldset' style='margin:0px 0px 0px 0px'>
<legend><strong>Forum Stats</strong></legend><b></b><br>";
$content .= $ibforums->lang['total_post'] . $std->do_number_format($total) . "<br/>";
$content .= $ibforums->lang['total_topic'] . $std->do_number_format($stats['TOTAL_TOPICS']) . "<br/>";
$content .= $ibforums->lang['total_mem'] . $std->do_number_format($stats['MEM_COUNT']) . "<br/>";
$content .= $ibforums->lang['last_mem'] . sprintf("<a href=\"{$this->url}?showuser=%d&s={$ibforums->session_id}\">%s</a>", $stats['LAST_MEM_ID'], $stats['LAST_MEM_NAME']);
$dlcontent = $DB->query('SELECT count(cid) as kid FROM ibf_files_cats WHERE copen=1');
$kats = $DB->fetch_row($dlcontent);
$content .= "<br>Kategorien: ". $kats['kid'];
$dlcontent = $DB->query('SELECT count(id) as cid, sum(downloads) as cdownloads, sum(views) as cviews FROM ibf_files WHERE open=1');
$kats2 = $DB->fetch_row($dlcontent);
$content .= "<br>Addons: ". $kats2['cid'];
$content .= "<br>Downloads: ". $kats2['cdownloads'];
$content .= "<br>Views: ". $kats2['cviews'];
$content .= "</fieldset>";
// Die 5 neusten Downloads
$content .= "<br><br><fieldset class='fieldset' style='margin:0px 0px 0px 0px'>
<legend><strong>Die 5 neusten Downloads</strong></legend><b></b><br>";
$content .= "<table width=\"97%\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">";
$content .= "<tr><td><strong>Name</strong></td><td><div align=\"right\"><strong>Dls/Views</strong></div></td></tr>";
$dlcontent = $DB->query('SELECT sname, id, views, downloads, open FROM ibf_files WHERE open=1 ORDER BY date DESC LIMIT 5');
while ($content5top = $DB->fetch_row($dlcontent)) {
$content .= "<tr><td><a href='".$this->base_url."index.php?download={$content5top['id']}'>{$content5top['sname']}</a></td>
<td align=\"right\"> <span style=\"font-size: 9px\">({$content5top['downloads']}/{$content5top['views']})</span></td></tr>";
}
$content .= "</table></fieldset><br>";
// Top File Downloads
$content .= "<fieldset class='fieldset' style='margin:0px 0px 0px 0px'>
<legend><strong>Top 5 Downloads</strong></legend><b></b><br>";
$content .= "<table width=\"97%\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">";
$content .= "<tr><td><strong>Name</strong></td><td><div align=\"right\"><strong>Dls</strong></div></td></tr>";
$dlcontent = $DB->query('SELECT sname, id, downloads, open FROM ibf_files WHERE open=1 ORDER BY downloads DESC LIMIT 5');
while ($content1top = $DB->fetch_row($dlcontent)) {
$content .= "<tr><td><a href='".$this->base_url."index.php?download={$content1top['id']}'>{$content1top['sname']}</a></td>
<td align=\"right\"> <span style=\"font-size: 9px\">({$content1top['downloads']})</span></td></tr>";
}
$content .= "</table></fieldset><br>";
// Top File Views
$content .= "<fieldset class='fieldset' style='margin:0px 0px 0px 0px'>
<legend><strong>Top 5 Views</strong></legend><b></b><br>";
$content .= "<table width=\"97%\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">";
$content .= "<tr><td><strong>Name</strong></td><td><div align=\"right\"><strong>Views</strong></div></td></tr>";
$dlcontent = $DB->query('SELECT sname, id, views, open FROM ibf_files WHERE open=1 ORDER BY views DESC LIMIT 5');
while ($content2top = $DB->fetch_row($dlcontent)) {
$content .= "<tr><td><a href='".$this->base_url."index.php?download={$content2top['id']}'>{$content2top['sname']}</a> </td>
<td align=\"right\"><span style=\"font-size: 9px\">({$content2top['views']})</span></td></tr>";
}
$content .= "</table></fieldset><br>";
// Top Submitters
$content .= "<fieldset class='fieldset' style='margin:0px 0px 0px 0px'>
<legend><strong>Top 5 Uploader</strong></legend><b></b><br>";
$content .= "<table width=\"97%\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">";
$content .= "<tr><td><strong>Name</strong></td><td><div align=\"right\"><strong>Files</strong></div></td></tr>";
$dlcontent = $DB->query('SELECT id, name, files FROM ibf_members ORDER BY files DESC LIMIT 5');
while ($content3top = $DB->fetch_row($dlcontent)) {
$content .= "<tr><td><a href='".$this->base_url."index.php?showuser={$content3top['id']}'>{$content3top['name']}</a> </td>
<td align=\"right\"> <span style=\"font-size: 9px\">({$content3top['files']})</span></td></tr>";
}
$content .= "</table></fieldset><br>";
// Top Downloaders
$content .= "<fieldset class='fieldset' style='margin:0px 0px 0px 0px'>
<legend><strong>Top 5 Downloader</strong></legend><b></b><br>";
$content .= "<table width=\"97%\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">";
$content .= "<tr><td><strong>Name</strong></td><td><div align=\"right\"><strong>Files</strong></div></td></tr>";
$dlcontent = $DB->query('SELECT id, name, downloads FROM ibf_members ORDER BY downloads DESC LIMIT 5');
while ($content4top = $DB->fetch_row($dlcontent)) {
$content .= "<tr><td><a href='".$this->base_url."index.php?showuser={$content4top['id']}'>{$content4top['name']}</a> </td>
<td align=\"right\"> <span style=\"font-size: 9px\">({$content4top['downloads']})</span></td></tr>";
}
$content .= "</table></fieldset><br>";
Kommentar