Pagina 4 di 4 primaprima ... 2 3 4
Visualizzazione dei risultati da 31 a 32 su 32

Discussione: Where Multipli

  1. #31
    Utente di HTML.it L'avatar di dottwatson
    Registrato dal
    Feb 2007
    Messaggi
    3,012
    questa è una prova, vedi se funziona a impostare SOLO la query per il momento. poi proseguiamo con l' impaginazione ad hoc senza utilizzare cose strane

    Codice PHP:
    <?php
    <body>
    <
    body link="#000082" vlink="#000042" alink="#000082" bgcolor="#FFFFFF">
    <
    tr><font face="Rockwell" size="2" color="#FF0000">ELENCO DEI RISULTATI RICERCATI:</font></tr>


    </
    p>
    <?
    php
    $max_res
    =25;  // quanti risultati per ogni pagina?


    //gestione errori
    function mysql_die($error "sconosciuto")
    {
    echo 
    "<H1>Errore:"$error."</H1>";
       exit;
    }
    //gestione connessione
    require "ezine_db.inc.php";
    $ezine_db ezine_connecte_db();


    $query_standard="SELECT id,data,comp,playa,teama,goala,vpna,playb,teamb,goalb,vpnb FROM partitelle";



    if (isset(
    $_GET['search'])) unset($_GET['search']);
    if (isset(
    $_GET['page'])) $now=($_GET['page']*$max_res)+1;
    else 
    $now=0;



    $PARAMS_A=array();
    $PARAMS_B=array();
    $fields=array('datsei'=>'partitelle.iddate',   //standard
                  
    'datsette'=>'partitelle.iddate'//standard
                  
    'datotto'=>'partitelle.iddate',  //standard
                  
    'com'=>'partitelle.comp',        //standard
                  
    'pla'=>'partitelle.play',
                  
    'tea'=>'partitelle.idteam',
                  
    'goa'=>'partitelle.goal',
                  
    'ris'=>'partitelle.vpn');


    foreach (
    $_GET as $key=>$value)
      {
      if (!empty(
    $_GET[$key]) && $_GET[$key] !="#"
        {
        if (
    $key !="datsei" && $key !="datsette" && $key !="datotto" && $key !="com")
          {
          
    $PARAMS_A[]=$fields[$key]."a='".$value."'";
          
    $PARAMS_B[]=$fields[$key]."b='".$value."'";
          }
        else
          { 
          
    $PARAMS_A[]=$fields[$key]."='".$value."'";
          
    $PARAMS_B[]=$fields[$key]."='".$value."'";
          }
        }
      }

    if (!empty(
    $PARAMS_A) && !empty($_PARAMS_B)) $end_query=$query_standard." WHERE (".implode(" AND ",$PARAMS_A).") OR (".implode(" AND ",$_PARAMS_B).") LIMIT $now,$max_res";
    else 
    $end_query=$query_standard." LIMIT $now,".$now+$max_res;

    echo 
    $end_query."
    "
    ;



    //impagino i risultati
    require_once("php.sql.pager.class");
    $_PAGER = new _makePager(25);
    $stringa mysql_query($ris);
    $_PAGER _getPagerData(mysql_result($stringa),$_GET[p]);
    $_sql mysql_query($stringa {$_PAGER->sql});
    while (
    $row mysql_fetch_row($_sql)) {

    //stampo i risultati in una tabella
        
    echo "

    </p>"
    ;
        echo 
    "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" style=\"border-left-style: solid; border-left-width: 1px; border-right-style: solid; border-right-width: 1px; border-top-style: solid; border-top-width: 1px;\" bordercolor=\"#999999\" id=\"table1\">";
        echo 
    "<tr>";
        echo 
    "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $d "</td>";
        echo 
    "<td align=\"center\" width=\"70\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $dt "</td>";
        echo 
    "<td align=\"center\" width=\"140\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $co "</td>";
        echo 
    "<td align=\"center\" width=\"100\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $pla "</td>";
        echo 
    "<td align=\"center\" width=\"140\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $tea "</td>";
        echo 
    "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $goa "</td>";
        echo 
    "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $va "</td>";
        echo 
    "<td align=\"center\" width=\"100\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $plb "</td>";
        echo 
    "<td align=\"center\" width=\"140\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $teb "</td>";
        echo 
    "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $gob "</td>";
        echo 
    "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $vb "</td>";
        echo 
    "</tr>";
    }
    ?>
    </body>
    ?>
    Non sempre essere l'ultimo è un male... almeno non devi guardarti le spalle

    il mio profilo su PHPClasses e il mio blog laboweb

  2. #32
    allora... facendo un semplice copia/incolla del tuo codice, non funzia. ho provato a stampare la $end_query, mi da come risultato "25", quindi suppongo che ci sia qualcosa che non funziona, infatti dice che mysql_result non trova risultati. per ora ho pubblicato tutto sul sito web http://iutenti.lycos.it/lugoroosters entrando devi scegliere archivio dal menù di sinistra... ovviamente senza impaginazione, è un po' palloso da scorrere ma si può migliorare la grafica, almeno quella.
    questo è il codice come ce l'ho adesso:
    Codice PHP:
    <?php 
    $max_res
    =25;  // quanti risultati per ogni pagina? 


    //gestione errori 
    function mysql_die($error "sconosciuto"

    echo 
    "<H1>Errore:"$error."</H1>"
       exit; 

    //gestione connessione 
    require "ezine_db.inc.php"
    $ezine_db ezine_connecte_db(); 


    $query_standard="SELECT id,data,comp,playa,teama,goala,vpna,playb,teamb,goalb,vpnb FROM partitelle"



    if (isset(
    $_GET['search'])) unset($_GET['search']); 
    if (isset(
    $_GET['page'])) $now=($_GET['page']*$max_res)+1
    else 
    $now=0



    $PARAMS_A=array(); 
    $PARAMS_B=array(); 
    $fields=array('datsei'=>'partitelle.iddate',   //standard 
                  
    'datsette'=>'partitelle.iddate'//standard 
                  
    'datotto'=>'partitelle.iddate',  //standard 
                  
    'com'=>'partitelle.comp',        //standard 
                  
    'pla'=>'partitelle.play'
                  
    'tea'=>'partitelle.idteam'
                  
    'goa'=>'partitelle.goal'
                  
    'ris'=>'partitelle.vpn'); 


    foreach (
    $_GET as $key=>$value
      { 
      if (!empty(
    $_GET[$key]) && $_GET[$key] !="#"
        { 
        if (
    $key !="datsei" && $key !="datsette" && $key !="datotto" && $key !="com"
          { 
          
    $PARAMS_A[]=$fields[$key]."a='".$value."'"
          
    $PARAMS_B[]=$fields[$key]."b='".$value."'"
          } 
        else 
          { 
          
    $PARAMS_A[]=$fields[$key]."='".$value."'"
          
    $PARAMS_B[]=$fields[$key]."='".$value."'"
          } 
        } 
      } 

    if (!empty(
    $PARAMS_A) && !empty($_PARAMS_B)) $end_query=$query_standard." WHERE (".implode(" AND ",$PARAMS_A).") OR (".implode(" AND ",$_PARAMS_B).") LIMIT $now,$max_res"
    else 
    $end_query=$query_standard." LIMIT $now,".$now+$max_res

    echo 
    $end_query."
    "


    //impagino i risultati 
    while ($row mysql_fetch_array($end_query)) { 

    //stampo i risultati in una tabella 
        
    echo "

    </p>"
    ;
        echo 
    "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" style=\"border-left-style: solid; border-left-width: 1px; border-right-style: solid; border-right-width: 1px; border-top-style: solid; border-top-width: 1px;\" bordercolor=\"#999999\" id=\"table1\">";
        echo 
    "<tr>";
        echo 
    "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $row[0] . "</td>";
        echo 
    "<td align=\"center\" width=\"70\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $row[1] . "</td>";
        echo 
    "<td align=\"center\" width=\"140\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $row[2] . "</td>";
        echo 
    "<td align=\"center\" width=\"100\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $row[3] . "</td>";
        echo 
    "<td align=\"center\" width=\"140\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $row[4] . "</td>";
        echo 
    "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $row[5] . "</td>";
        echo 
    "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $row[6] . "</td>";
        echo 
    "<td align=\"center\" width=\"100\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $row[7] . "</td>";
        echo 
    "<td align=\"center\" width=\"140\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $row[8] . "</td>";
        echo 
    "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $row[9] . "</td>";
        echo 
    "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" $row[10] . "</td>";
        echo 
    "</tr>";
    }
    ?>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.