Ecco il mio problema...
Codice PHP:
<? include ("connect_db.php");
$colonne=6; if (($tipo == " ") && ($marca == " ")){
$count = mysql_query("SELECT COUNT(id) FROM sb_mod where attivo='1' order by id desc");} elseif (($tipo != " ") && ($marca == " ")){
$count = mysql_query("SELECT COUNT(id) FROM sb_mod where tipo='$tipo' and attivo='1' order by id desc");} elseif (($tipo == " ") && ($marca != " ")){
$count = mysql_query("SELECT COUNT(id) FROM sb_mod where marca='$marca' and attivo='1' order by id desc");} elseif (($tipo != " ") && ($marca != " ")){
$count = mysql_query("SELECT COUNT(id) FROM sb_mod where tipo='$tipo' and marca='$marca' and attivo='1' order by id desc");} $res_count = mysql_fetch_row($count);
// numero totale di records $tot_records = $res_count[0];
// risultati per pagina(secondo parametro di LIMIT) $per_page = 30;
// numero totale di pagine $tot_pages = ceil($tot_records / $per_page);
// pagina corrente $current_page = (!$_GET['page']) ? 1 : (int)$_GET['page'];
// primo parametro di LIMIT $primo = ($current_page - 1) * $per_page;
// esecuzione seconda query con LIMIT if (($tipo == " ") && ($marca == " ")){
$query_limit = "SELECT * FROM sb_mod where attivo='1' LIMIT $primo, $per_page";} if (($tipo != " ") && ($marca == " ")){
$query_limit = "SELECT * FROM sb_mod where tipo='$tipo' and attivo='1' LIMIT $primo, $per_page";} if (($tipo == " ") && ($marca != " ")){
$query_limit = "SELECT * FROM sb_mod where marca='$marca' and attivo='1' LIMIT $primo, $per_page";} if (($tipo != " ") && ($marca != " ")){
$query_limit = "SELECT * FROM sb_mod where tipo='$tipo' and marca='$marca' and attivo='1' LIMIT $primo, $per_page";} $res = @mysql_query($query_limit); $righe = @mysql_num_rows($res); ?> <tr> <td align="center" height="25px" width="100%"> <table cellpadding="0" cellspacing="0" width="100%" align="left"> <tr> <td width="100%"><? if(($righe = @mysql_num_rows($res)) == 0){
echo "<table cellpadding=\"2\" cellspacing=\"0\" width=\"100%\" <tr> <td valign=\"top\" class=\"testo1\" colspan=\"2\">La ricerca non ha trovato articoli.</td> </tr> <tr><td height=\"230\"></td></tr> </table>";} if(($righe = @mysql_num_rows($res))> 0){ ?> <table cellpadding="0" cellspacing="0" width="100%"> <? for($v = 0; $v < $righe; $v++) {
$r = @mysql_fetch_array($res); $testo=split(" ", $r[nome_mod]); if($v % $colonne == 0){?> <tr> <? } ?> <td valign="top" width="100px"> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td width="100%" valign="top" align="left"> <table width="100%" cellpadding="0" cellspacing="0"><? $result = mysql_query("select * from sb_fotomod where id_mod='$r[id]' and sel='1'"); $num_rows = mysql_num_rows($result); $queryfoto = "select * from sb_fotomod where id_mod='$r[id]' and sel='1'"; $resultfoto = mysql_query($queryfoto); $f=0; $foto=mysql_result($resultfoto,$f,"foto"); echo "<tr><td><a href=\"scheda.php?id=$r[id]\" target=\"_self\" class=\"border\"><img src=\"resize.php?maxx=120&maxy=85&src=http://www.calcionetwork.it/sorellebeltrame/admin/modelli/images/fotomodelli/$foto\"></a></td></tr> <tr> <td> <table cellpadding=\"3\" cellspacing=\"0\" width=\"100%\" bgcolor=\"#666666\"> <tr> <td class=\"testo8\" align=\"left\" width=\"25%\">Tipologia:</td> <td class=\"testo8\" align=\"left\">$r[tipo]</td> </tr> <tr> <td class=\"testo8\" align=\"left\">Marca:</td> <td class=\"testo8\" align=\"left\">$r[marca]</td> </tr> <tr> <td class=\"testo8\" align=\"left\">Modello:</td> <td class=\"testo8\" align=\"left\">$testo[0]"." $testo[1]"." ..</td> </tr> </table> </td> </tr>"; ?> </table> </td> </tr> <tr> <td height="30px" width="100%" colspan="3"></td> </tr> </table> <? if(($v % $colonne) == ($colonne - 1) || ($v + 1) == $righe){
echo "<table><tr><td></td></tr></table>";}
} ?> </td> </tr> <tr><td colspan="6"><hr class="hr" /></td></tr> </table> <? } // includiamo uno dei files contenenti la paginazione, commentate l'altro ovviamente //include("paginazione_1.php"); include("paginazione_2.php"); // in questa cella inseriamo la paginazione echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr>\n <td valign=\"top\" align=\"left\" class=\"testo2\" colspan=\"7\" width=\"100%\">$paginazione</td>\n"; echo " <tr><table>";
mysql_close(); ?>
Le ricerce vengono effettuate bene e pure la restituzione dei valori nella prima pagina..Se passo alla seconda pagina mi viene scritto "La ricerca non ha trovato articoli." ... Non so se è un problema legato ai 4+4 IF iniziali, o ad altro..
Non so piu come andar avanti, le ho provate tutte veramente..Grazie mille se qualcuno mi potrà consigliare..