show one field above looped output table
Moderator: General Moderators
show one field above looped output table
It is not a problem to also show the seasondate within the looped table, but there is no idea in that, when it ofcourse is the same all the way down.
So what I wish to do is show the seasondate above the looped table.
Can anyone point me in the right direction?
I have this (index.php)
Code: Select all
<?
$username="???";
$password="???";
$database="???";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query="SELECT Sæsoner.*, Områder.*, Hold.SæsonID
FROM (Områder INNER JOIN Sæsoner ON Områder.OmrådeID = Sæsoner.OmrådeID) INNER JOIN Hold ON Sæsoner.SæsonID = Hold.SæsonID GROUP BY Hold.SæsonID ORDER BY Sæsoner.SæsonID ASC;";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
<table width="300px" border="1" cellspacing="0" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Sæson periode</font></th>
<th><font face="Arial, Helvetica, sans-serif">Område</font></th>
</tr>
<?
$i=0;
while ($i < $num) {
$sæsonid=mysql_result($result,$i,"sæsonid");
$sæsonfra=mysql_result($result,$i,"sæsonfra");
$sæsontil=mysql_result($result,$i,"sæsontil");
$område=mysql_result($result,$i,"område");
$seasonstart = date('d-m-Y', strtotime($sæsonfra));
$seasonend = date('d-m-Y', strtotime($sæsontil));
?>
<tr>
<td align="center"><font face="Arial, Helvetica, sans-serif"><a href="undervisning.php?ssid=<? echo $sæsonid ?>&s2id=<? echo $sæsonid ?>" target="_self" Title="Vis sæsonperioden <? echo $seasonstart." - ".$seasonend; ?>"><? echo $seasonstart." - ".$seasonend; ?></a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $område; ?></font></td>
</tr>
<?
$i++;
}
echo "</table>";
?>Sæson periode Område
14-02-2005 - 04-06-2005 Sjælland
07-02-2005 - 29-05-2005 Jylland
When the date wich is a link is clicked I go to the next page:
Code: Select all
<?
$username="???";
$password="???";
$database="???";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query="SELECT Byer.*, Hold.*, Lokaler.*, Minutterfra.*, Minuttertil.*, Niveauer.*, Områder.*, Priser.*, Stilarter.*, Sæsoner.*, Timerfra.*, Timertil.*, Ugedage.*, Undervisere.*
FROM Undervisere INNER JOIN (Ugedage INNER JOIN (Timertil INNER JOIN (Timerfra INNER JOIN ((Stilarter INNER JOIN (Priser INNER JOIN (Områder INNER JOIN (Niveauer RIGHT JOIN (Minuttertil INNER JOIN (Minutterfra INNER JOIN ((Byer INNER JOIN Lokaler ON Byer.ByID = Lokaler.ByID) INNER JOIN Hold ON Lokaler.LokaleID = Hold.LokaleID) ON Minutterfra.MinutterfraID = Hold.MinutterfraID) ON Minuttertil.MinuttertilID = Hold.MinuttertilID) ON Niveauer.NiveauID = Hold.NiveauID) ON Områder.OmrådeID = Byer.OmrådeID) ON Priser.PrisID = Områder.PrisID) ON Stilarter.StilartID = Hold.StilartID) INNER JOIN Sæsoner ON (Områder.OmrådeID = Sæsoner.OmrådeID) AND (Hold.SæsonID = Sæsoner.SæsonID)) ON Timerfra.TimerfraID = Hold.TimerfraID) ON Timertil.TimertilID = Hold.TimertilID) ON Ugedage.UgedagID = Hold.UgedagID) ON Undervisere.UnderviserID = Hold.UnderviserID;
WHERE ((Lokaler.LokaleID='$lkid' && Sæsoner.SæsonID='$ssid') || (Ugedage.UgedagID='$udid' && Sæsoner.SæsonID='$ssid') || (Stilarter.StilartID='$said' && Sæsoner.SæsonID='$ssid') || (Niveauer.NiveauID='$nvid' && Sæsoner.SæsonID='$ssid') || (Undervisere.UnderviserID='$uvid' && Sæsoner.SæsonID='$ssid') || (Sæsoner.SæsonID='$ssid' && Sæsoner.SæsonID='$s2id'))
ORDER BY Lokaler.LokaleID, Ugedage.UgedagID, Timerfra.Timerfra ASC";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
//This following little table is what I need to work.
it should be the same date which is clicked on index.php,
for now it is just blank. I can see the logic in why it does not work,
cause it is outside the loop,
so another solution which I can't find is needed.
<table width="200px">
<tr>
<td align="right"><? echo $sæsonfra." - ".$sæsontil; ?></td>
</tr>
</table>
<table width="100%">
<tr>
<td width="10px"></td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" class="sortable" id="1">
<tr>
<th align="left"><font face="Arial, Helvetica, sans-serif">Holdnr</font></th>
<th align="left"><font face="Arial, Helvetica, sans-serif">Stilart</font></th>
<th align="left"><font face="Arial, Helvetica, sans-serif">Niveau</font></th>
<th align="left"><font face="Arial, Helvetica, sans-serif">Tid</font></th>
<th align="left"><font face="Arial, Helvetica, sans-serif">Lokale</font></th>
<th align="left"><font face="Arial, Helvetica, sans-serif">Ugedag</font></th>
<th align="left"><font face="Arial, Helvetica, sans-serif">Underviser</font></th>
</tr>
<?
$i=0;
while ($i < $num) {
$sæsonfra=mysql_result($result,$i,"sæsonfra");
$sæsontil=mysql_result($result,$i,"sæsontil");
$sæsonid=mysql_result($result,$i,"sæsonid");
$holdnr=mysql_result($result,$i,"holdnr");
$timerfra=mysql_result($result,$i,"timerfra");
$minutterfra=mysql_result($result,$i,"minutterfra");
$timertil=mysql_result($result,$i,"timertil");
$minuttertil=mysql_result($result,$i,"minuttertil");
$alderfra=mysql_result($result,$i,"alderfra");
$aldertil=mysql_result($result,$i,"aldertil");
$niveau=mysql_result($result,$i,"niveau");
$niveauid=mysql_result($result,$i,"niveauid");
$stilartnavn=mysql_result($result,$i,"stilartnavn");
$stilartid=mysql_result($result,$i,"stilartid");
$lokale=mysql_result($result,$i,"lokale");
$lokaleid=mysql_result($result,$i,"lokaleid");
$ugedag=mysql_result($result,$i,"ugedag");
$ugedagid=mysql_result($result,$i,"ugedagid");
$undervisernavn=mysql_result($result,$i,"undervisernavn");
$underviserid=mysql_result($result,$i,"underviserid");
?>
<tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $holdnr; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="?ssid=<? echo $sæsonid ?>&said=<? echo $stilartid ?>" target="_self" Title="<? echo $stilartnavn; ?>"><? echo $stilartnavn; ?></a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? if ($niveauid=="0") {echo $alderfra." - ".$aldertil." år";} elseif ($alderfra=="0") {echo '<a href="?ssid=',$sæsonid,'&nvid=',$niveauid,'" target="_self" Title="',$niveau,'">',$niveau,'</a>';} else {echo $alderfra." - ".$aldertil." år, ".'<a href="?ssid=',$sæsonid,'&nvid=',$niveauid,'" target="_self" Title="',$niveau,'">',$niveau,'</a>';} ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $timerfra.":".$minutterfra." - ".$timertil.":".$minuttertil; ?></a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="?ssid=<? echo $sæsonid ?>&lkid=<? echo $lokaleid ?>" target="_self" Title="<? echo $lokale; ?>"><? echo $lokale; ?></a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="?ssid=<? echo $sæsonid ?>&udid=<? echo $ugedagid ?>" target="_self" Title="<? echo $ugedag; ?>"><? echo $ugedag; ?></a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="?ssid=<? echo $sæsonid ?>&uvid=<? echo $underviserid ?>" target="_self" Title="<? echo $undervisernavn; ?>"><? echo $undervisernavn; ?></a></font></td>
</tr>
<?
$i++;
}
echo "</table>";
?>
</td>
</tr>
</table>2) if the date is being passed in the url, you can either use the $_GET[] array to display your date, or if you want to use the var you grab from the db and you only have one result, use a mysql_fetch_assoc to create an associative array and display your date from there ie: echo $row['date']. If you have multiple rows, you can use mysql_data_seek() to return the pointer back to the beginning of the array after you've displayed the date, or build a new array with the results and display the first key (or whatever key has your date).
most of that was shot from the hip as I still don't fully understand what your problem is
Code: Select all
echo "<a href = 'newpage.php?date1=".$date1."&date2=".$date2.">";Code: Select all
<a href="undervisning.php?ssid=<? echo $sæsonid ?>&s2id=<? echo $sæsonid ?>" target="_self" ?></a>After reading burrito's post again I think thats maybe the solution, but I'll have to learn about it before I write back.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"e;sæsonfra"e;);
fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra&ane $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.Code: Select all
$sæsonfra=my hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Dhe solution just better ways to do what I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Dhelping me help myself :Dt fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid, I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"e;sæsontil"e;);Thanks for helping me help myself :Done and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");$sæsontil=mysql_result($result,$ssid,"sæsontil");Now I just echo that information out above looped table. (stupid me)
Thanks for helping me help myself :Dust better ways to do what I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for he_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Now I just echo that information out above looped table. (stupid me)
Thanks for helping me help myself
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,& to move those two lines above the loop and write them like this.Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Dtable. (stupid me)
Thanks for helping me help myself :Dhe solution just better ways to do what I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Duote;);
$sæsontil=mysql_result($result,$ssid,"sæsontil");Now I just echo that information out above looped table. (stupid me)
Thanks for helping me help myself :Dto do what I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Ds to do what I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,&amso if I am already sending the season id I just have to move those two lines above the loop and write them like this.Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Dphp]$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Now I just echo that information out above looped table. (stupid me)
Thanks for helping me help myself :Dut it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Dt better ways to do what I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Dlt($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Now I just echo that information out above looped table. (stupid me)
Thanks for helping me help myself :Dhe solution just better ways to do what I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mydy. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.Code: Select all
$sæsonfra=mysql_result($result,$ssid,"e;sæsonfra"e;);
$sæsontil=mysql_result($result,$ssid,"e;sæsontil"e;);Thanks for helping me help myself :onfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Dhe solution just better ways to do what I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"e;sæsonfra"e;);
$sæsontil=mysql_result($result,$ssid,&q the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.Code: Select all
$sæsonfra=mysql_result($result,$ssid,"e;sæsonfra"e;);
$sæsontil=mysql_result($result,$ssid,"e;sæsontil"e;);Thanks for helping me help myself :Dresult($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself
Thanks for helping me help myself :Dlt,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Now I just echo that information out above looped table. (stupid me)
Thanks for helping me help myself :Dsæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Dhe solution just better ways to do what I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks ks don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_reways to do what I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself
$sæsontil=mysql_result($result,$ssid,"sæsontil");Now I just echo that information out above looped table. (stupid me)
Thanks for helping me helesult,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"e;sæsonfra"e;);
$sæsontil=mysqlt me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Dto do what I do already. If it works don't fix it.
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Di,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.
Code: Select all
$sæsonfra=mysql_result($result,$ssid,"e;sæsonfra"e;)
But it suuddently hit me that this line $sæsonfra=mysql_result($result,$i,"sæsonfra"); is the important one and the $i is the field to get so if I am already sending the season id I just have to move those two lines above the loop and write them like this.Code: Select all
$sæsonfra=mysql_result($result,$ssid,"sæsonfra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Thanks for helping me help myself :Dra");
$sæsontil=mysql_result($result,$ssid,"sæsontil");Now I just echo that information out above looped table. (stupid me)
Thanks for helping me help myself
$sæsontil=mysql_result($result,$ssid,"sæsontil");Now I just echo that information out above looped table. (stupid me)
Thanks for helping me help myself