De pagina: http://wmomusic.org/fl1/flpets3.php
Ik doe iets helemaal fout... Ik krijg namelijk geen resultaten. Ik heb vanalles gelezen en geprobeerd, maar kan nergens een dergelijk voorbeeld vinden. Misschien moet ik iedere skill steeds afzonderlijk op laten halen (loop) uit de DB tabel? Ik heb echter geen idee hoe ik moet beginnen :)
Wat werkt wel: http://wmomusic.org/fl1/flpets2.php zo werkt het wel. Echter dat is niet de bedoeling. De bedoeling is iedere petID 1x displayen in de tabel.
mijn script:
<html>
<body text="#000000">
<?php
include("../connect.php");
$query="SELECT pets.PET_ID, pets.Petname, pets.element_id, elements.element_id, elements.elementname,
pets.Levelmin, pets.Levelmax, pets.imageurl, petskill.Pet_ID, petskill.Skill_ID, skills.SKILL_ID, GROUP_CONCAT(DISTINCT skills.skillname ORDER BY skills.skillname DESC SEPARATOR ', '), GROUP_CONCAT(locations.Location SEPARATOR ', '), petlocations.LOC_ID, petlocations.PET_ID, locations.LOC_ID
FROM pets
JOIN elements
ON pets.element_id=elements.element_id
JOIN petlocations
ON pets.PET_ID=petlocations.Pet_ID
JOIN locations
ON petlocations.LOC_ID=locations.LOC_ID
JOIN petskill
ON pets.PET_ID=petskill.Pet_ID
JOIN skills
ON petskill.Skill_ID=skills.SKILL_ID
GROUP BY pets.PET_ID
LIMIT 0,30";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Earthpets</center></b><br><br>";
?>
<center>
<table border="1" cellspacing="2" cellpadding="2" bgcolor="#FFFFFF" width="900">
<tr>
<th>Pet name</th>
<th>Element</th>
<th>Levelmin</th>
<th>Levelmax</th>
<th>Skills</th>
<th>Location</th>
<th>Picture</th>
</tr>
<?php
$i=0;
while ($i < $num) {
$Petname=mysql_result($result,$i,"Petname");
$elementname=mysql_result($result,$i,"elementname");
$Levelmin=mysql_result($result,$i,"Levelmin");
$Levelmax=mysql_result($result,$i,"Levelmax");
$skillname=mysql_result($result,$i,"skillname");
$Location=mysql_result($result,$i,"Location");
$imageurl=mysql_result($result,$i,"imageurl");
?>
<tr>
<td><?php echo $Petname; ?></td>
<td><?php echo $elementname; ?></td>
<td><?php echo $Levelmin; ?></td>
<td><?php echo $Levelmax; ?></td>
<td><?php echo $skillname; ?></td>
<td><?php echo $Location; ?></td>
<td><img src="<?php echo $imageurl; ?>"</td>
</tr>
<?php
$i++;
}
?>
</body>
</html>
Wie heeft er een hint? Waar ga ik de mist in?