Jump to content


Photo

Using data from the same table twice


  • Please log in to reply
2 replies to this topic

#1 leszekmk

leszekmk
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 09 January 2004 - 07:47 AM

I use DWMX, PHP and mySQL.
Using an insert form I am entering data in an event table--where a record contains, among other entries from various tables, two different entries from the same table (name of contact person 1 and name of contact person 2 coming from a table of contact people using list/menu option). When I display the content of the event table in the repeat area the recordset is supposed to list contact people data (fname, lname) but instead of listing two different data for two different individuals it repeats the data for the first contact person twice. I checked in myphpadmin and the event table has the data entered and stored properly (I store indices refering the data in the contact table for these two individuals) but in the process of specifying what to display in DWMX I end up with the same result twice since with DWMX I am unable (I do not know how) to differentiate fname, lname for the first contact person from fname, lname for the second individual.
Would you please recommend the proper way to do it in DWMX? I do not want to keep two different tables with the same data (one for contact people 1 and second for contact people 2, it is the same group of people after all).
Thank you.

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 09 January 2004 - 05:44 PM

hey take a look at http://www.phpfreaks...showtopic=13236 its another of my posts and you may see how it lists all the rows in a table.
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 leszekmk

leszekmk
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 11 January 2004 - 03:38 PM

I do not see how you can list the names if you store the index number.

Is there an option in DW that would handle listing two entries from one table in a single resordset? I was thinking about using aliases for that table but at the end you end up in the DW listing something that does not differentiate between two entries--in the definition of recordset rsEventData it seems like the alias is working but later whent displaying the recordset the name of the table is dropped and the script looks like this:

<?php echo $row_rsEventData['contactfname']." ".$row_rsEventData['contactlname']; ?>
<?php echo $row_rsEventData['contactfname']." ".$row_rsEventData['contactlname']; ?>

Since the name of the table /aliases are not mentioned the two will result in duplicate output.

Please help. Thank you.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users