Salve a tutti, ho un grosso problema oggi..
sto facendo un modulino di ricerca nel sito. Ho creato l'index vuoto, i 2 file php e l'xml che riporto qui sotto.
Ora il modulo si vede, ma il filtro non fa nulla..sembra morto...
PS: ovviamente ho creato le opportune tabelle nel database nel jos_content (solo li giusto?)
XML
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="1.6.0" client="site" method="upgrade">
<name>sw ajax</name>
<description>Modulo form filtro</description>
<files>
<filename module="mod_sw_ajax">mod_sw_ajax.php</filename>
<filename module="mod_sw_ajax">mod_sw_ajax2.php</filename>
<filename>index.html</filename>
</files>
<params>
</params>
</extension>
QUESTO INVECE è il ajax2.php
<?php
$db_host = "*********";
$db_user = "*********";
$db_password = "*********";
//$db_user = "root";
//$db_password = "";
$db_name = "*********";
$connessione = mysql_connect($db_host,$db_user,$db_password);
@mysql_select_db($db_name,$connessione);
// --------------------------
// informazioni in GET da url
// --------------------------
$q = $_GET["q"];
$a = $_GET["a"];
$b = $_GET["b"];
$c = $_GET["c"];
$d = $_GET["d"];
$e = $_GET["e"];
$f = $_GET["f"];
$g = $_GET["g"];
$h = $_GET["h"];
$i = $_GET["i"];
$l = $_GET["l"];
$m = $_GET["m"];
$html = "";
$stringaSQL = "catid=13 ";
// componenti della stringa SQL
echo "sono qui";
if($m == "1"){
$stringaSQL .= " AND baby_sitting = 1";
}
if($l == "1"){
$stringaSQL .= " AND spiaggia_riservata = 1";
}
if($i == "1"){
$stringaSQL .= " AND balcone_terrazza = 1";
}
if($h == "1"){
$stringaSQL .= " AND piscina = 1";
}
if($g == "1"){
$stringaSQL .= " AND animazione = 1";
}
if($f == "1"){
$stringaSQL .= " AND aperto_12m = 1";
}
if($e == "1"){
$stringaSQL .= " AND parcheggio = 1";
}
if($d == "1"){
$stringaSQL .= " AND centro_benessere = 1";
}
if($c == "1"){
$stringaSQL .= " AND wifi = 1";
}
if($b == "1"){
$stringaSQL .= " AND animali = 1";
}
if($a == "1"){
$stringaSQL .= " AND frontemare = 1";
}
if($q != ""){
$stringaSQL .= " AND ricerca_libera LIKE'%$q%'";
}
// costruisco la stringa
$sqlRicerca = "SELECT * FROM jos_content WHERE ($stringaSQL) ORDER BY id ASC";
echo "sql=".$sqlRicerca;
$resultRicerca = @mysql_query($sqlRicerca,$connessione);
$recordsRicerca = @mysql_fetch_object($resultRicerca);
$contatore = 0;
$colore = " colore1";
if (!$recordsRicerca) {
$html .= "<div class=\"sw_box $colore\">Nessun risultato</div>";
}
while ($recordsRicerca) {
$nomeHotel = $recordsRicerca->title;
$urlHotel = "http://www.hotel4stellejesolo.com/index.php?option=com_content&view=article&id=".$recordsRicerca->id."&catid=".$recordsRicerca->catid."&Itemid=153";
if ($contatore % 2 == 0) {
$colore = " style=\"{background-color:#efefef;}\"";
}
$html .= "<div class=\"sw_box $colore\">";
$html .= "<b>$nomeHotel</b><br />";
$html .= "<b><a title=\"page $nomeHotel\" href=\"$urlHotel\">Page</a></b><br />";
$html .= "</div>";
$contatore ++;
$recordsRicerca = @mysql_fetch_object($resultRicerca);
}
@mysql_free_result($resultRicerca);
// output
echo $html;
@mysql_close($connessione);
?>