Udskkrivning fra tabel
Jeg har dette script hvor der normalvis kun skal udskrives en rytter per placering. I enkelte tilfælde skal der dog udskrives to på samme linje. Med det her script udskrives rytter nummer to på alle linjer hvor han kun skal udskrives under placering 1.Se: http://www.tourfacts.dk/freddy/result2.php?aar=1961&lob=1&racename=Druivenkoers-Overijse
<?php
$res = mysql_query("SELECT
dat.dateid,
dat.datyear,
dat.length,
dat.starters,
dat.ave,
dat.missing,
dat.route,
alt.resultid,
alt.ridercomment,
alt.placering,
alt.ridersname,
alt.racetime,
alt.lob,
race.raceid,
race.racename,
ryt.id,
ryt.name,
ryt.prof,
lan.landid,
lan.fodeland,
lan.inter
FROM raceresult1 AS alt
INNER JOIN racedata AS dat ON dat.datyear = alt.ayear
INNER JOIN races AS race ON alt.lob = race.raceid
INNER JOIN riders AS ryt ON alt.ridersname = ryt.id
INNER JOIN country AS lan ON ryt.country = lan.landid
WHERE dat.datyear=$aar AND alt.lob = race.raceid AND race.raceid=$lob GROUP BY resultid ORDER BY resultid ASC");
$i = 1;
while($r = mysql_fetch_array($res)) {
echo "<table width='100%' border='0' cellspacing='0' cellpadding='1' style='border-bottom: 1px dashed blue;'><tr>";
echo "<td width='5%' align='center' valign='middle'>";
echo "$r[placering]\n";
echo "</td>";
echo "<td width='7%' align='center' valign='middle' class='land'>$r[inter]</td>";
echo "<td width='80%' align='left' valign='middle'>";
echo "<table border='0' width='100%' valign='middle' cellspacing='0' cellpadding='0'><tr>\n";
echo "<td width='50%' align='left' valign='middle'>";
echo "<a href=http://www.tourfacts.dk/freddy/riders.php?id=$r[id] class='link2'>$r[name]</a>\n";
echo "</td>";
echo "<td width='50%' align='left' valign='middle'>";
$res1 = mysql_query("SELECT
dat.dateid,
dat.datyear,
alt.resultid,
alt.rider2,
race.raceid,
race.racename,
ryt.id,
ryt.name
FROM raceresult1 AS alt
INNER JOIN racedata AS dat ON dat.datyear = alt.ayear
INNER JOIN races AS race ON alt.lob = race.raceid
INNER JOIN riders AS ryt ON alt.rider2 = ryt.id
WHERE dat.datyear=$aar AND alt.lob = race.raceid AND race.raceid=$lob GROUP BY resultid ORDER BY resultid ASC");
while($r1 = mysql_fetch_array($res1)) {
if(!$r1[rider2]); else echo "<a href=http://www.tourfacts.dk/freddy/riders.php?id=$r1[id] class='link2'>$r1[name]</a>\n";
}
echo "</td>";
echo "</tr></table>\n";
echo "<td align='right' valign='middle'>";
if(!$r[racetime]); else echo "$r[racetime]\n";
echo "</td>";
echo "</tr><tr>";
echo "<td align='left' valign='middle' colspan='6'>";
if(!$r[ridercomment]); else echo "<font color=#E9005E'> $r[ridercomment]</font>\n";
echo "</td>";
echo "</tr></table>";
}
$number = 0;
?>
Er der mon en der kan fortælle mig hvad jeg har overset?