Dear flexer,

I try to load a datagrid with httpservice.
But, I'm so desapointed because load about 17000 lines take around 5 sec.
So can you help me to optimize this time.

<?php 

// Send the content-type header:
header('Content-Type: text/xml');


// Include the database information script:
require_once ('MySQL.php');
require_once ('conf.php');
include('functions.php');

// Connect to the database:
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PWD, DB_DATABASE);

// If a connection was established, run the query:
if ($dbc) { 

        // Define the query:
        $q ='SELECT 20Patients_1012.paIndex, 20Patients_1012.paNomP, 
20Patients_1012.paPrenom, 20Patients_1012.paCodePostal, 
20Patients_1012.paDossier1, 20Patients_1012.paDossier2, 
20Patients_1012.paNaissance, 20Patients_1012.paNumTel1, 
30Traitemnt_201223.ttTStatutP, 30Traitemnt_201223.ttDateStatut, 
12Praticien_02.prInitiales FROM 20Patients_1012 JOIN 30Traitemnt_201223 ON 
20Patients_1012.paIndex = 30Traitemnt_201223.ttIndex JOIN 12Praticien_02 ON 
30Traitemnt_201223.ttPraticien = 12Praticien_02.prIndex';
        }
        
        // Run the query:
        $r = mysqli_query($dbc, $q);
        
                $reponse = "<patients>";

        // Confirm that some rows were returned:
        if (mysqli_num_rows($r) > 0) {
                // Fetch every row and print it as XML:
                while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
 $reponse.="<id>".$row[0]."</id><pr>".$row[2]."</pr><st>"
                        .$row[8]." ".$row[9]."</st><d1>".$row[4]." / "
                        
.$row[5]."</d1><dn>".$row[6]."</dn><pr2>".$row[10]."</pr2>"
                        ."<dn>".$row[6]."</dn>";

                        } // End of WHILE loop.
                        

        } // End of mysqli_num_rows() IF.

} // End of $dbc IF.

// Complete the XML:
$reponse.="</patients>";
printf ("%s",$reponse);

mysql_free_result($reponse);
?>

Thanks

Reply via email to