<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[aiuto estrazione database]]></title><description><![CDATA[<p dir="auto">Ciao ho una pagina in php del genere</p>
<pre><code class="language-php">&lt;?php
//zOOm Media Gallery//
/** 
-----------------------------------------------------------------------
|  zOOm Media Gallery! by Mike de Boer - a multi-gallery component    |
-----------------------------------------------------------------------

-----------------------------------------------------------------------
|                                                                     |
| Author: Mike de Boer, &lt;http://www.mikedeboer.nl&gt;                    |
| Copyright: copyright (C) 2006 by Mike de Boer                       |
| Description: zOOm Media Gallery, a multi-gallery component for      |
|              Joomla!. It's the most feature-rich gallery component  |
|              for Joomla!! For documentation and a detailed list     |
|              of features, check the zOOm homepage:                  |
|              http://www.zoomfactory.org                             |
| License: GPL                                                        |
| Filename: special.php                                               |
|                                                                     |
-----------------------------------------------------------------------
* @version $Id: special.php,v 1.20 2006/08/02 18:52:50 kevinuru Exp $
* @package zOOmGallery
* @author Mike de Boer &lt;mailme@mikedeboer.nl&gt; 
**/
// MOS Intruder Alerts
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $size;
/**
 There are three special image-display formats:
 0: Top ten viewed images (most hits)
 1: Ten last submitted images (last id's)
 2: Ten last commented images
 4: Top rated
**/
$sorting = intval(trim(mosGetParam($_REQUEST, 'sorting')));
if ($sorting == 1 || $sorting == 2) {
    $where_prefix = "WHERE ";
} else {
    $where_prefix = "AND ";
}
if ($zoom-&gt;_isAdmin) {
    $where_clause = "";
} else {
    $where_clause = $where_prefix."cats.catpassword = '' AND img.published = 1";

}
switch($sorting){
  case 0:
    $database-&gt;setQuery("SELECT DISTINCT img.imgid AS id, img.catid AS gallery_id FROM #__zoomfiles AS img LEFT JOIN #__zoom AS cats ON img.catid = cats.catid WHERE imghits &gt; 0 $where_clause ORDER BY imghits DESC LIMIT 10");
    break;

  case 1:
    $database-&gt;setQuery("SELECT DISTINCT img.imgid AS id, img.catid AS gallery_id FROM #__zoomfiles AS img LEFT JOIN #__zoom AS cats ON img.catid = cats.catid $where_clause ORDER BY id DESC LIMIT 10");
    break;

  case 2:
    $database-&gt;setQuery("SELECT DISTINCT com.imgid, img.imgid AS id, img.catid AS gallery_id, max(com.cmtid) as maxcmt FROM #__zoomfiles AS img LEFT JOIN #__zoom_comments AS com ON com.imgid = img.imgid LEFT JOIN #__zoom AS cats ON img.catid = cats.catid $where_clause GROUP BY id ORDER BY maxcmt desc LIMIT 10");
    break;
  
  case 4:
    $database-&gt;setQuery("SELECT DISTINCT img.imgid AS id, img.catid AS gallery_id, img.votenum, (img.votesum/img.votenum) AS rating FROM #__zoomfiles AS img LEFT JOIN #__zoom AS cats ON img.catid = cats.catid WHERE img.votesum &gt; 0 AND img.votenum &gt; 0 $where_clause ORDER BY rating desc, img.votenum DESC LIMIT 10");
    break;
  
  default:
    die("You must visit this page the legit way, remember?");
}
$zoom-&gt;_result = $database-&gt;query();
if ($zoom-&gt;_CONFIG['ratingOn']) {
    $zoom-&gt;createRatingCSS();
}
?&gt;
&lt;script language="javascript" type="text/javascript" src="&lt;?php echo $mosConfig_live_site;?&gt;/components/com_zoom/lib/js/prototype.js"&gt;&lt;/script&gt;
&lt;table border="0" cellspacing="0" cellpadding="0" width="100%"&gt;
  &lt;tr&gt;
    &lt;td width="30" class="&lt;?php echo $zoom-&gt;_tabclass[1]; ?&gt;"&gt;&lt;/td&gt;
    &lt;td class="&lt;?php echo $zoom-&gt;_tabclass[1]; ?&gt;"&gt;
    &lt;?php if ($zoom-&gt;_CONFIG['mainscreen']) { ?&gt;
        &lt;a href="&lt;?php echo sefRelToAbs("index".$backend.".php?option=com_zoom&amp;Itemid=".$Itemid);?&gt;"&gt;
        &lt;img src="&lt;?php echo $mosConfig_live_site;?&gt;/components/com_zoom/www/images/home.gif" alt="" border="0" /&gt;&amp;nbsp;&amp;nbsp;&lt;?php echo _ZOOM_MAINSCREEN;?&gt;&lt;/a&gt;&amp;nbsp;|&amp;nbsp;
    &lt;?php 
    }
    if($sorting==0) echo _ZOOM_TOPTEN;
    else if($sorting==1) echo _ZOOM_LASTSUBM;
    else if($sorting==2) echo _ZOOM_LASTCOMM;
    else if($sorting==4) echo _ZOOM_TOPRATED;
    ?&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;table border="0" cellspacing="0" cellpadding="3" width="100%"&gt;
&lt;?php
$i = 0;
$imgcnt = 0;
$tabcnt = 0;
if (mysql_num_rows($zoom-&gt;_result) &gt; 0) {
    while($row = mysql_fetch_object($zoom-&gt;_result)){
        $imgcnt++;
        $zoom-&gt;setGallery($row-&gt;gallery_id);
        $zoom-&gt;_counter = 0;
        foreach($zoom-&gt;_gallery-&gt;_images as $image){
            if($image-&gt;_id == $row-&gt;id){
                $i = $zoom-&gt;_counter;
            }
            $zoom-&gt;_counter++;
        }
        $zoom-&gt;_gallery-&gt;_images[$i]-&gt;getInfo();
        if ($zoom-&gt;_gallery-&gt;isMember() &amp;&amp; $zoom-&gt;_gallery-&gt;_images[$i]-&gt;isMember()) {
            echo '&lt;tr class="'.$zoom-&gt;_tabclass[$tabcnt].'"&gt;&lt;td width="20"&gt;&amp;nbsp; '.$imgcnt.' &amp;nbsp;&lt;/td&gt;';
            if (!$zoom-&gt;_CONFIG['popUpImages']) {
                ?&gt;
                &lt;td align="left" width="&lt;?php echo $zoom-&gt;_CONFIG['size'];?&gt;"&gt;
                &lt;a href="&lt;?php echo sefRelToAbs("index".$backend.".php?option=com_zoom&amp;amp;Itemid=".$Itemid."&amp;amp;page=view&amp;amp;catid=".$zoom-&gt;_gallery-&gt;_id."&amp;amp;key=".$i."&amp;amp;hit=1");?&gt;"&gt;
                &lt;?php
            } else {
                $params = $zoom-&gt;encrypt("catid=".$zoom-&gt;_gallery-&gt;_id."&amp;amp;key=".$i."&amp;amp;isAdmin=".$zoom-&gt;_isAdmin."&amp;amp;hit=1");
                ?&gt;
                &lt;td align="left" width="&lt;?php echo $zoom-&gt;_CONFIG['size'];?&gt;"&gt;
                &lt;?php
                $link = "&lt;a href=\"javascript:void(0)\" onClick=\"window.open('".$mosConfig_live_site."/components/com_zoom/www/view.php?popup=1&amp;amp;q=".$params."', 'win1', 'width=";
                if ($size[0] &lt; 550) {
                    $link .= "550";
                } elseif ($size[0] &gt; $zoom-&gt;_CONFIG['maxsize']) {
                    $link .= $zoom-&gt;_CONFIG['maxsize'] + 50;
                } else {
                    $link .= $size[0] + 40;
                }
                $link .= ", height=";
                if ($size[1] &lt; 550) {
                    $link .= "550";
                } elseif ($size[1] &gt; $zoom-&gt;_CONFIG['maxsize']) {
                    $link .= $zoom-&gt;_CONFIG['maxsize'] + 50;
                } else {
                    $link .= $size[1] + 100;
                }
                $link .= ", scrollbars=1').focus()\"&gt;\n";
                echo $link;
            }
            echo '&lt;img src="'.$zoom-&gt;_gallery-&gt;_images[$i]-&gt;_thumbnail.'" border="0" alt="" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;td width="10"&gt;&lt;/td&gt;';
            echo '&lt;td align="left"&gt;&lt;b&gt;'.$zoom-&gt;_gallery-&gt;_images[$i]-&gt;_filename.'&lt;/b&gt;&lt;br /&gt;';
            if ($zoom-&gt;_CONFIG['showHits'])
                echo _ZOOM_HITS.' = '.$zoom-&gt;_gallery-&gt;_images[$i]-&gt;_hits.'&lt;br /&gt;';
            if ($zoom-&gt;_CONFIG['ratingOn']) {
                echo $zoom-&gt;_gallery-&gt;_images[$i]-&gt;getStars();
            }
            echo "&lt;a href=\"".sefRelToAbs("index.php?option=com_zoom&amp;Itemid=".$Itemid."&amp;catid=".$zoom-&gt;_gallery-&gt;_id)."\"&gt;".$zoom-&gt;_gallery-&gt;getCatVirtPath()."&lt;/a&gt;";
            //new feature
            if ($sorting == 2){ 
                $dir_prefix = $mosConfig_live_site."/components/com_zoom/www/";
                $smilies = $zoom-&gt;_getSmiliesTable();
                $lastelement = count($zoom-&gt;_gallery-&gt;_images[$i]-&gt;_comments);
                
                if ($lastelement &lt;&gt; ""){
                    $comment = $zoom-&gt;_gallery-&gt;_images[$i]-&gt;_comments[$lastelement-1];
    
                    echo "&lt;table style=\"border: 1px solid #cccccc\" width=\"98% \"&gt;";
                    echo "&lt;tr&gt;&lt;td&gt;&lt;b&gt;".$comment-&gt;_name."(".$comment-&gt;_date.")&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;";
                    $theComment = $comment-&gt;_processSmilies($comment-&gt;_comment,$dir_prefix,$smilies);
                    
                    echo "&lt;tr&gt;&lt;td&gt;".$theComment."&lt;/td&gt;&lt;/tr&gt;";
                    echo "&lt;/table&gt;";
                }
            }
            echo "&lt;/td&gt;&lt;/tr&gt;";
            if ($tabcnt &gt;= 1) {
                $tabcnt = 0;
            } else {
                $tabcnt++;
            }
        } else {
        ?&gt;
                &lt;tr&gt;
        &lt;td&gt;&lt;?php echo _ZOOM_NOIMG; ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;?php
        }
    }
} else {
    ?&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;?php echo _ZOOM_NOIMG; ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;?php
}
?&gt;
&lt;/table&gt;
</code></pre>
<p dir="auto">che mi estra dal database le immagini piu votate, le piu cliccate e le piu commentate, però io vorrei che facesse tutto cio ma me le estraesse da una precisa categoria (che so divertenti, paesaggi . . . ) e non le piu votate, cliccate . . . in generale</p>
<p dir="auto">come posso fare ?</p>
<p dir="auto">queste sono le categorie del mio database jos_zoom</p>
<p dir="auto">Grazie <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=3abbd2034aa" class="not-responsive emoji emoji-android emoji--disappointed" style="height:1.4em;width:auto;vertical-align:middle" title=":(" alt="😞" /></p>
<pre><code> Testo completo        catid         catname         catdescr         catdir         catimg         catpassword         catkeywords         subcat_id         pos         hideMsg         shared         published         uid         catmembers         custom_order
</code></pre>
<p dir="auto">e jos_zoomfiles</p>
<pre><code> Testo completo        imgid         imgname         imgfilename         imgdescr         imgkeywords         imgdate         imghits         votenum         votesum         published         catid         uid         imgmembers
</code></pre>
]]></description><link>https://dev.connect.gt/topic/35323/aiuto-estrazione-database</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Dec 2026 22:19:47 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/35323.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 14 May 2007 09:41:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to aiuto estrazione database on Mon, 14 May 2007 13:29:18 GMT]]></title><description><![CDATA[<p dir="auto">più precisamente img.catid='X'</p>
]]></description><link>https://dev.connect.gt/post/509097</link><guid isPermaLink="true">https://dev.connect.gt/post/509097</guid><dc:creator><![CDATA[fdalesio]]></dc:creator><pubDate>Mon, 14 May 2007 13:29:18 GMT</pubDate></item><item><title><![CDATA[Reply to aiuto estrazione database on Mon, 14 May 2007 13:28:43 GMT]]></title><description><![CDATA[<p dir="auto">prova ad aggiungere alla query dopo i where "and catid='X'"<br />
dove X è l'id della categoria dalla quale vuoi estrarre le immagini</p>
]]></description><link>https://dev.connect.gt/post/509096</link><guid isPermaLink="true">https://dev.connect.gt/post/509096</guid><dc:creator><![CDATA[fdalesio]]></dc:creator><pubDate>Mon, 14 May 2007 13:28:43 GMT</pubDate></item></channel></rss>