<?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[Dov'è l'errore? Non genera i link nelle colonne.]]></title><description><![CDATA[<p dir="auto">Ciao ragazzi. Ho un problema con il seguente codice.<br />
In pratica questo mi genera una tabella con due colonne con tutti i nomi delle provincie e fin qui tutto bene perchè l'elenco è perfetto e anche l'incolonnamento.<br />
Il problema riguarda il link alla pagina della provincie.<br />
In pratica mi fa l'elenco delle provincie ma mi genera per tutte lo stesso link fermo ad Alessandria! ($city_url)<br />
Non riesco a capire dov'è l'errore. Se qualcuno può aiutarmi mi farebbe un gran piacere</p>
<pre><code class="language-php">&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;
  &lt;tr&gt;
    &lt;td valign="top"&gt;&lt;?php
// Show city list
if($location_sort) 
{
 $sort1 = "ORDER BY countryname";
 $sort2 = "ORDER BY cityname";
}
else
{
 $sort1 = "ORDER BY c.pos";
 $sort2 = "ORDER BY ct.pos";
}
if ($show_region_adcount || $show_city_adcount)
{
 // First get ads per city and country
 $country_adcounts = array();
 $city_adcounts = array();
 $sql = "SELECT ct.cityid, c.countryid, COUNT(*) as adcnt
   FROM $t_ads a
    INNER JOIN $t_cities ct ON ct.cityid = a.cityid AND ($visibility_condn)
    INNER JOIN $t_countries c ON ct.countryid = c.countryid
   WHERE ct.enabled = '1' AND c.enabled = '1'
   GROUP BY ct.cityid";
 $res = mysql_query($sql) or die(mysql_error().$sql);
 while($row=mysql_fetch_array($res))
 {
  $country_adcounts[$row['countryid']] += $row['adcnt'];
  $city_adcounts[$row['cityid']] += $row['adcnt'];
 }
}
$sql = "SELECT * FROM $t_countries c INNER JOIN $t_cities ct ON c.countryid = ct.countryid AND ct.enabled = '1' WHERE c.enabled = '1' GROUP BY c.countryid $sort1";
$resc = mysql_query($sql);
$country_count = mysql_num_rows($resc);
//$split_at = ($country_count%3?((int)($country_count/3))+2:($country_count/3)+1);
$percol = floor($country_count/$location_cols);
$percolA = array();
for($i=1;$i&lt;=$location_cols;$i++) $percolA[$i]=$percol+($i&lt;=$country_count%$location_cols?1:0);
$i = 0; $j = 0;
$col = 1;
while($country = mysql_fetch_array($resc))
{
 if($sef_urls) $country_url = "{$vbasedir}-$country[countryid]_" . RemoveBadURLChars($country['countryname']) . "/";
 else $country_url = "?cityid=-$country[countryid]&amp;lang=$xlang";
?&gt;
 
 &lt;div&gt;&lt;a href="&lt;?php echo $country_url; ?&gt;" class="citylist_country"&gt;&lt;?php echo $country['countryname']; ?&gt; &lt;?php if($show_region_adcount) echo "(".(0+$country_adcounts[$country['countryid']]).")"; ?&gt;&lt;/a&gt;&lt;/div&gt;
 
 
   &lt;?php 
if($country['countryid'] == $xcountryid || !$expand_current_region_only)
 {
  $sql = "SELECT * FROM $t_cities ct WHERE countryid = $country[countryid] AND enabled = '1' $sort2";
  $resct = mysql_query($sql);
  while($city=mysql_fetch_array($resct))
  {
   if($sef_urls) $city_url = "{$vbasedir}$city[cityid]_" . RemoveBadURLChars($city['cityname']) . "/";
   else $city_url = "?cityid=$city[cityid]&amp;lang=$xlang";
$num_record = mysql_num_rows($resct); 
$colonne = 2; 
$tot_righe = $num_record/$colonne; 
$i_x = 0; 
$x_x = 0; 
$k_x = 0; 
$cell_width = floor(100/$colonne); 
echo 
'&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F7F793"&gt; 
    &lt;tr&gt;'; 
while($city = mysql_fetch_array($resct)) 
{ 
    $i_x++; 
    $k_x++; 
    $x_x++; 
    echo "&lt;td width=\"".$cell_width."%\"&gt;&lt;a href=\"".$city_url."\" class=\"citylist_city\"&gt;".$city['cityname']."";
if($show_city_adcount)
$a = "(0+".$city_accounts[$city['cityid']].")";
echo "".$a."&lt;/a&gt;&lt;/td&gt;"; 
    if($i_x == $colonne) 
    { 
        echo'&lt;/tr&gt;'; 
        if($i_x == $colonne &amp;&amp; (($x_x/$colonne) != $tot_righe)) 
        { 
            echo'&lt;tr&gt;'; 
        } 
        $i_x = 0; 
    } 
} 
if($colonne &lt;= $x_x) 
{ 
    if(($k_x%$colonne) != 0) 
    { 
        $indice = $k_x; 
        while (($indice%$colonne) != 0 ) 
        { 
            echo'&lt;td&gt;&amp;nbsp;&lt;/td&gt;'; 
            $indice++; 
        } 
        if(($indice%$colonne) == 0 ) 
        { 
            echo'&lt;/tr&gt;'; 
        } 
    } 
} 
else{ 
    echo '&lt;/tr&gt;'; 
} 
echo '&lt;/table&gt;'; 
?&gt;
 
 
 &lt;?php
  }
 }
 ?&gt;
 
 &lt;?php
 
}
?&gt;
&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/topic/47376/dov-è-l-errore-non-genera-i-link-nelle-colonne</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Dec 2026 06:45:08 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/47376.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Sep 2007 08:42:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dov'è l'errore? Non genera i link nelle colonne. on Fri, 21 Sep 2007 15:23:30 GMT]]></title><description><![CDATA[<p dir="auto">Potete chiudere, ho risolto in un altra maniera. Grazie lo stesso.</p>
]]></description><link>https://dev.connect.gt/post/603477</link><guid isPermaLink="true">https://dev.connect.gt/post/603477</guid><dc:creator><![CDATA[barattomusicale]]></dc:creator><pubDate>Fri, 21 Sep 2007 15:23:30 GMT</pubDate></item><item><title><![CDATA[Reply to Dov'è l'errore? Non genera i link nelle colonne. on Wed, 19 Sep 2007 18:26:16 GMT]]></title><description><![CDATA[<p dir="auto">Uppino</p>
]]></description><link>https://dev.connect.gt/post/603476</link><guid isPermaLink="true">https://dev.connect.gt/post/603476</guid><dc:creator><![CDATA[barattomusicale]]></dc:creator><pubDate>Wed, 19 Sep 2007 18:26:16 GMT</pubDate></item></channel></rss>