Jump to content

Recommended Posts

Hello, over ther!
Please bear with me. My English seems not to be good enough to find the right topic.

My problem is as follows: I try to show a list ov events, the user could choose and then it should change to the detail mask with the choosen event.

I got the list, it shows the right primary id in the title (was just for test, so I knew, I should be right) but than - bang! On the next page it always shows the id from the last event. I surely have a logical error. Could You please help me? Thanks a lot.

Now the codesnippets:

start:
include("../dbdata.inc.php");
@mysql_connect($server, $username, $password);
# Database connection
@mysql_select_db($database) or die("Kann nicht mit Berechtigungsdatenbank verknüpfen");
# query
//$query="SELECT s.Bezeichnung AS Kurs, s.Datum_von, s.Datum_bis, s.Ort, s.Leiter, s.Preis FROM oenrdb_bu.seminar s ORDER BY s.Datum_von";
$query="SELECT v.Seminar_ID, v.Kursbezeichnung, v.Jahr, v.Datum_von, v.Datum_bis, v.SemOrt_ID, v.Leiter, v.Lehrer, v.Min, v.Max, v.Preis_M, v.Preis, v.Status, v.Abgesagt, v.WListe, v.S_1, v.S_2, v.S_3, v.S_4, v.S_5, v.S_6, v.S_7, v.S_P, v.S_Z, v.S_D, v.V_1, v.V_2, v.V_3, v.V_4, v.V_5, v.V_6, v.V_7, v.V_P, v.V_Z, v.Kommentar, v.SeminarOrtPLZ, v.SeminarOrt, v.SeminarOrtBezeichnung, v.LeiterTitel, v.LeiterVorname, v.LeiterName FROM vw_seminar v";
$result=mysql_query($query);
# check, how much answers do we have
$num= mysql_num_rows($result);
mysql_close();

... and so on (HTML Stuff)

NOW: [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]
<?php
# reading from buffer
$i=0;
while ($i<$num) {
$_SESSION['datenID'] = mysql_result($result, $i, "Seminar_ID");
$Kursnummer = mysql_result($result, $i, "Seminar_ID");
$Kursbezeichnung = mysql_result($result, $i, "Kursbezeichnung");
$DatumVon = mysql_result($result, $i, "Datum_von");
$VDatumStr = date("d.m.Y",getdate(mysql_result($result, $i, "Datum_von")));
$DatumBis = mysql_result($result, $i, "Datum_bis");
$SeminarOrtBezeichnung = mysql_result($result, $i, "SeminarOrtBezeichnung");
$SeminarOrtPLZ = mysql_result($result, $i, "SeminarOrtPLZ");
$SeminarOrtName = mysql_result($result, $i, "SeminarOrt");
$SeminarOrt = $SeminarOrtBezeichnung.', '.$SeminarOrtPLZ.' '.$SeminarOrtName;
$SeminarLeiterTitel = mysql_result($result, $i, "LeiterTitel");
$SeminarLeiterVorname = mysql_result($result, $i, "LeiterVorname");
$SeminarLeiterFamName = mysql_result($result, $i, "LeiterName");
if (strlen($SeminarLeiterTitel)>0){
$SeminarLeiter = $SeminarLeiterTitel.' '.$SeminarLeiterVorname.' '.$SeminarLeiterFamName;
}
else {
$SeminarLeiter = $SeminarLeiterVorname.' '.$SeminarLeiterFamName;
}
$Preis = mysql_result($result, $i, "Preis");
# output-task
?>

<td class="bodyText" valign="top">
<?php $_SESSION['datenID'] = $Kursnummer;
/* THERE IS THE BAD THING
* It shows the right number of the event, but gives the last to the next page
* no Synchronisation
*/?> [img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /]
[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]<p><strong><a href="./seminardetail.php" <?php sessionschreiber($Kursnummer); ?> title=<?php echo $_SESSION['datenID']; ?> > [!--colorc--][/span][!--/colorc--]
[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]<?php echo $Kursbezeichnung.' '.$Kursnummer; ?></a></strong> <br class="quote" />[!--colorc--][/span][!--/colorc--]
<?php echo $DatumVon; ?>
bis
<?php echo $DatumBis; ?> <br />
<?php # echo $VDatumStr; ?>
Seminarleiter:
<?php echo $SeminarLeiter; ?> <br />
Veranstaltungsort:
<?php echo $SeminarOrt; ?> </p> </td>
</tr>
<?php
++$i;
}
?>

sessionschreiber($Kursnummer) does only one of two things: either (preferred) assigning the variable $_SESSION['datenID'] = $Kursnummer or writing the primary key to a database. It is always the last number of events

Thanks in advance
Henry
Link to comment
https://forums.phpfreaks.com/topic/10922-newbie-question-what-else/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.