SitePoint Sponsor

User Tag List

Results 1 to 1 of 1

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Kelowna, BC, Canada
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help with SELECT in Dreamweaver MX - NM, solved

    {edit: I've solved the problem, so no need to reply, but I'll keep the text of the post here in case any other newbs run across the same issue... }

    Hi all,

    I've got a problem with displaying data from more than one table in Dreamweaver MX, and it's maddening me. I'm somewhat of a PHP/mySQL newb, so please bear with me.

    I'll start by describing what I want to do. I've got a database with registrants for a retreat. Using normalized database design, I've got multiple tables for some data, with tables like registrants, groups (each registrant is assigned to a group), provinces, etc.

    What I'm trying to do seems simple, but it's not working. I want to display a listing of the registrants names, when they were registered, and their group name. The group name is causing me fits. I want to display not the group_id number that exists in the registrants table, but the name of the group from the groups table.

    I've built a display table in Dreamweaver to house the results, and applied a Repeat Region behaviour to the table to display all the registrants. The names and dates are working fine, but I'm having trouble with the data from multiple tables.

    The SELECT query I've built in Dreamweaver MX in a Recordset named "rsGroups" is this:

    Code:
    SELECT groups.group_name
    FROM groups, registrants
    WHERE registrants.group_id = groups.id
    When I press the "Test" button, the proper results are displayed - each record returns the proper group name. However, when I drag the Binding from that Recordset onto the page and test the page in a browser, only the first group name is displayed, and it is displayed with each record as if each record belonged to that group.

    The code for the display in the table is this:

    Code:
    <?php echo $row_rsGroups['group_name']; ?>
    Everything else is working properly - all the data is inserted correctly, the group_id field displays the proper number, and all that. I just can't get the group name to display instead of the group id number. I'm thinking that I might possibly need a JOIN statement, but I'm not sure. Any help from anyone on where I'm going wrong would be much appreciated.

    Thanks in advance,
    Michael.

    {edit: I just solved my own problem - I needed to have that all in one Recordset instead of two separate ones.}
    Last edited by graphis; Feb 3, 2005 at 04:03. Reason: solved the problem


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •