Beste,
Tot voor kort wilde een plaatjesoverzicht, opgehaald uit een db, altijd +/- 350 miniatuurplaatjes laden op één pagina. Sinds kort haalt hij maar de helft, hij stopt 'ineens'. Ondertussen zie ik het browersbalkje laden als een malle, waar geen eind aan komt.
Ik heb zelf al wat zitten sleutelen aan het script, maar het wil me maar niet lukken.
Ben me bewust van de MySQL --> MySQLi (wat volgens jullie voor de toekomst gewijzigd moet worden).
Wie ziet waar het mis gaat?
Groetjes,
Ty
Zie hier de pagina:
http://microlepidoptera.nl/soorten/thumbnail_index.php?familie=Tortricidae&type=lijst
Dit is het script:
<?php
//LIJSTWEERGAVE MODUS
if($photoclass == lijst)
{
//set the number of columns
$columns = 4;
$familie = $_GET['familie'];
$query = "SELECT * FROM data_naamlijst WHERE familie LIKE '%" .$familie. "%' ORDER BY nummer";
$result = mysql_query($query);
//we add this line because we need to know the number of rows
$num_rows = mysql_num_rows($result);
echo "<table width='100%' border='0' align='center' class='tekst'>";
//changed this to a for loop so we can use the number of rows
for ( $i = 0 ; $i < $num_rows ;$i++ ) {
$row = mysql_fetch_array($result);
if($i % $columns == 0) {
//if there is no remainder, we want to start a new row
echo "<TR>";
}
// indien xi dan is de soort beschikbaar in de database met foto en en soortbeschrijving en wordt de soort
// - gelinkt in de naamlijst en zoekresultaten weergegeven
// - met daarachter een F en I icoontje in de naamlijst en zoekresultaten weer gegeven
// - wordt de eerste foto weergegeven in de photodatabase in het thumbnailoverzicht
if ($row['indatabase'] == xi)
{
echo "<td valign='top'> <table cellpadding='0' cellspacing='0' width='155'>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr>
<tr>
<td valign='top' width='150' height='4' ><div align='center'><a href='species.php?speciescode=". $row['speciescode'] ."&p=1'><img src='../database/thumbnails/" .$row['speciescode']. "_1.jpg' width='150' height='100' border='0'></div></a></td>
</tr>
<tr>
<td valign='top' class='cursief'><div align='center'>" . $row['nlnaam'] . "<br><i>" . $row['genus'] . " " . $row['soort'] . "</i></span></div></td>
</tr>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr></table>
</td>";
}
// indien x dan is de soort beschikbaar in de database met alleen een foto en wordt de soort
// - gelinkt in de naamlijst en zoekresultaten weergegeven
// - met een "Foto" icoontje in de naamlijst en zoekresultaten weergegeven
// - wordt de eerste foto weergegeven in de photodatabase in het thumbnailoverzicht
else if ($row['indatabase'] == x)
{
echo "<td valign='top'> <table cellpadding='0' cellspacing='0' width='155'>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr>
<tr>
<td valign='top' width='150' height='4' ><div align='center'><a href='species.php?speciescode=". $row['speciescode'] ."&p=1'><img src='../database/thumbnails/" .$row['speciescode']. "_1.jpg' width='150' height='100' border='0'></div></a></td>
</tr>
<tr>
<td valign='top' class='cursief'><div align='center'>" . $row['nlnaam'] . "<br><i>" . $row['genus'] . " " . $row['soort'] . "</i></span></div></td>
</tr>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr></table>
</td>";
}
// indien i dan is de soort beschikbaar in de database met alleen een soortbeschrijving en wordt de soort
// - gelinkt in de naamlijst en zoekresultaten weergegeven
// - met een "Info" icoontje in de naamlijst en zoekresultaten weergegeven
// - wordt de het plaatje "beschrijving beschikbaar" weergegeven in het thumbnailoverzicht
else if ($row['indatabase'] == i)
{
echo "<td valign='top'> <table cellpadding='0' cellspacing='0' width='155'>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr>
<tr>
<td valign='top' width='150' height='4' ><div align='center'><a href='species.php?speciescode=". $row['speciescode'] ."&p=1'><img src='../database/thumbnails/1111.jpg' width='150' height='100' border='0'></div></a></td>
</tr>
<tr>
<td valign='top' class='cursief'><div align='center'>" . $row['nlnaam'] . "<br><i>" . $row['genus'] . " " . $row['soort'] . "</i></span></div></td>
</tr>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr></table>
</td>";
}
// in alle overige gevallen dan is de soort onbeschreven en zonder fotos in de database beschikbaar en wordt de soort
// - ongelinkt in de naamlijst en zoekresultaten weergegeven
// - wordt het plaatje "geen afbeelding" weergegeven
else
{
echo "<td valign='top'> <table cellpadding='0' cellspacing='0' width='155'>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr>
<tr>
<td valign='top' width='150' height='4' ><div align='center'><a href='species.php?speciescode=". $row['speciescode'] ."&p=1'><img src='../database/thumbnails/0000.jpg' width='150' height='100' border='0'></div></a></td>
</tr>
<tr>
<td valign='top' class='cursief'><div align='center'>" . $row['nlnaam'] . "<br><i>" . $row['genus'] . " " . $row['soort'] . "</i></span></div></td>
</tr>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr></table>
</td>";
}
if(($i % $columns) == ($columns - 1) || ($i + 1) == $num_rows) {
//if there is a remainder of 1, end the row
//or if there is nothing left in our result set, end the row
echo "</TR>\n";
}
}
echo "</TABLE>\n";
}
//ALLE FOTOS WEERGEVEN MODUS
elseif($photoclass == all)
{
//set the number of columns
$columns = 4;
$familie = $_GET['familie'];
$query = "SELECT * FROM photos WHERE familie LIKE '%" .$familie. "%' ORDER BY geldigenaam";
$result = mysql_query($query);
//we add this line because we need to know the number of rows
$num_rows = mysql_num_rows($result);
echo "<table width='100%' border='0' align='left' class='tekst'>";
//changed this to a for loop so we can use the number of rows
for($i = 0; $i < $num_rows; $i++) {
$row = mysql_fetch_array($result);
if($i % $columns == 0) {
//if there is no remainder, we want to start a new row
echo "<TR>";
}
echo "<td valign='top'> <table cellpadding='0' cellspacing='0' width='155'>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr>
<tr>
<td valign='top' width='150' height='4' ><div align='center'><a href='species.php?speciescode=". $row['speciescode'] ."&p=". $row['photonr'] ."'><img src='../database/thumbnails/" .$row['speciescode']. "_" . $row['photonr'] . ".jpg' width='150' height='100' border='0'></div></a></td>
</tr>
<tr>
<td valign='top' class='cursief'><div align='center'><i>" . $row['geldigenaam'] . "</i></span></div></td>
</tr>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr></table>
</td>";
if(($i % $columns) == ($columns - 1) || ($i + 1) == $num_rows) {
//if there is a remainder of 1, end the row
//or if there is nothing left in our result set, end the row
echo "</TR>\n";
}
}
echo "</TABLE>\n";
}
//TYPE MODUS - SELECTEER MUSEUM
elseif($photoclass == museum)
{
//set the number of columns
$columns = 4;
$familie = $_GET['familie'];
$query = "SELECT * FROM museum WHERE familie LIKE '%" .$familie. "%' ORDER BY geldigenaam";
$result = mysql_query($query);
//we add this line because we need to know the number of rows
$num_rows = mysql_num_rows($result);
echo "<table width='100%' border='0' align='left' class='tekst'>";
//changed this to a for loop so we can use the number of rows
for($i = 0; $i < $num_rows; $i++) {
$row = mysql_fetch_array($result);
if($i % $columns == 0) {
//if there is no remainder, we want to start a new row
echo "<TR>";
}
echo "<td valign='top'> <table cellpadding='0' cellspacing='0' width='155'>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr>
<tr>
<td valign='top' width='150' height='4' ><div align='center'><a href='museum.php?speciescode=". $row['speciescode'] ."&m=". $row['museumnr'] ."'><img src='../database/thumbnails/museum/" .$row['speciescode']. "_" . $row['museumnr'] . ".jpg' width='150' height='100' border='0'></div></a></td>
</tr>
<tr>
<td valign='top' class='cursief'><div align='center'><i>" . $row['geldigenaam'] . "</i></span></div></td>
</tr>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr></table>
</td>";
if(($i % $columns) == ($columns - 1) || ($i + 1) == $num_rows) {
//if there is a remainder of 1, end the row
//or if there is nothing left in our result set, end the row
echo "</TR>\n";
}
}
echo "</TABLE>\n";
}
//TYPE MODUS - SELECTEER ADULT, POP, LARVE, EI, VRAATSPOOR
else
{
//set the number of columns
$columns = 4;
//Soortinformatie
$familie = $_GET['familie'];
//Type selectie
$photoclass = $_GET['type'];
//Query voor Alles die aan dit type in deze familie voldoen
$query = "SELECT * FROM photos WHERE familie LIKE '%" .$familie. "%' AND photoclass LIKE '" .$photoclass. "' ORDER BY speciescode";
$result = mysql_query($query);
//we add this line because we need to know the number of rows
$num_rows = mysql_num_rows($result);
echo "<table width='100%' border='0' align='left' class='tekst'>";
//changed this to a for loop so we can use the number of rows
for($i = 0; $i < $num_rows; $i++) {
$row = mysql_fetch_array($result);
if($i % $columns == 0) {
//if there is no remainder, we want to start a new row
echo "<TR>";
}
echo "<td valign='top'> <table cellpadding='0' cellspacing='0' width='155'>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr>
<tr>
<td valign='top' width='150' height='4' ><div align='center'><a href='species.php?speciescode=". $row['speciescode'] ."&p=". $row['photonr'] ."'><img src='../database/thumbnails/" .$row['speciescode']. "_" . $row['photonr'] . ".jpg' width='150' height='100' border='0'></div></a></td>
</tr>
<tr>
<td valign='top' class='cursief'><div align='center'><i>" . $row['geldigenaam'] . "</i></span></div></td>
</tr>
<tr>
<td valign='top' height='4'><div align='center'></div></td>
</tr></table>
</td>";
if(($i % $columns) == ($columns - 1) || ($i + 1) == $num_rows) {
//if there is a remainder of 1, end the row
//or if there is nothing left in our result set, end the row
echo "</TR>\n";
}
}
echo "</TABLE>\n";
}
?>
1.213 views