Hi,
I need help with my first php project. I display some information about my customers in various lists, and when the database grows the time it takes to load these pages increases rapidly. With about 150 customers it takes almost 8 seconds for the page to load! Can someone give me a hint what I might do wrong here? When I look at the data base in phpmyadmin, this table with even more info displays instantaneous, but I was unable to analyze the code of that tool to find out what they do differently.
I use a local XAMPP to serve the pages, so it’s not a data transfer problem.
Here’s the relevant piece of the code:
<div id="KundenDivBody" style="height:6cm; overflow:auto; padding:1px">
<table id="KundentabelleBody" class="Kundenliste" rules="all">
<?php
$abfrage = "SELECT * FROM kunden ORDER BY Nachname";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
echo "<tr".(($row->Aktiv==1) ? " class='Normal'" : " class='Reserviert'")." id='Kunde$row->Kunde'>n";
echo "<td onclick='editNummer($row->Kunde, "$row->Nachname", "$row->Vorname")'>n";
echo $row->Kunde."n";
echo "</td>n";
echo "<td onclick='editNachname($row->Kunde, "$row->Nachname")'>n";
echo $row->Nachname."n";
echo "</td>n";
echo "<td onclick='editVorname($row->Kunde, "$row->Vorname")'>n";
echo $row->Vorname."n";
echo "</td>n";
echo "<td onclick='javascript:editTelefon($row->Kunde, "$row->Nachname", "$row->Vorname", "$row->Telefon")'>n";
echo $row->Telefon."n";
echo "</td>n";
echo "<td onclick='toggleHelfer($row->Kunde, "$row->Nachname", "$row->Vorname", $row->Helfer)'>n";
echo (($row->Helfer==1) ? "Ja" : "Nein")."n";
echo "</td>n";
echo "<td onclick='toggleAlthelfer($row->Kunde, "$row->Nachname", "$row->Vorname", $row->Althelfer)'>n";
echo (($row->Althelfer==1) ? "Ja" : "Nein")."n";
echo "</td>n";
echo "<td onclick='toggleAktiv($row->Kunde, "$row->Nachname", "$row->Vorname", $row->Aktiv)'>n";
echo (($row->Aktiv==1) ? "Aktiv" : "Reserviert")."n";
echo "</td>n";
echo "<td class='Loeschen' onclick='delKunde($row->Kunde, "$row->Nachname", "$row->Vorname")'>n";
echo "L?¶schenn";
echo "</td>n";
echo "</tr>n";
}
?>
</table>
</div>
If I comment out all the echo lines, it’s fast again, so it’s not the data base acces that’s slowing it down. I also tried writing all these lines into a variable and then use a single echo to send it, but that didn’t help.
Thank you in advance for any help you may be able to give me!