Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Filter recordset

  1. #11
    Join Date
    Jan 2009
    Posts
    17
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    I thought that it was working, but it still doesn't seem to be functioning. Basically this is what I am looking for the result to look like. I will have headings that are not dynamic text.

    Nursery: [NAME(s) from Table where DEPARTMENT in equal to Nursery]
    Wee Church: [NAME(s) from Table where DEPARTMENT in equal to Wee Church]

    And so on...

    When I have the code that is referenced in the last post, inside a repeat region it repeats the whole entire table for every record. When I leave out a repeat region it doesn't return any results at all.

    Below is the code that I a have when it repeats everything for each record.

    Code:
    <?php do { ?>
        <strong>Nursery</strong><br />
      <?php
    
    if($row_Recordset1['department'] == 'Nursery') {
    
    echo $row_Recordset1['names']."</p>";
    
    }?>
      <br />
      <strong>Baby Ministers</strong><br />
      <?php
    
    if($row_Recordset1['department'] == 'Baby Minister') {
    
    echo $row_Recordset1['names']."</p>";
    
    }
    
    ?>
      <br />
      <strong>Pre Wee Church</strong><br />
      <?php
    
    if($row_Recordset1['department'] == 'Pre Wee Church') {
    
    echo $row_Recordset1['names']."</p>";
    
    }
    
    ?>
      <br />
      <strong>Wee Church</strong><br />
      <?php
    
    if($row_Recordset1['department'] == 'Wee Church') {
    
    echo $row_Recordset1['names']."</p>";
    
    }
    
    ?>
      <br />
      <strong>Childrens Church</strong><br />
      <?php
    
    if($row_Recordset1['department'] == 'Childrens Church') {
    
    echo $row_Recordset1['names']."</p>";
    
    }
    
    ?>
      <br />
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
    Thanks so much for your input.

  2. #12
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    What do you mean by 'repeat region'? Do you mean you only want one result?
    - Josh

  3. #13
    Join Date
    Jan 2009
    Posts
    17
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    I do have more than one name under each heading, I have found that if I want to display more than just the first result on the page I need to have it inside a 'repeat region' (this could be Dreamweaver term). I may be mistaken about this, but that is usually how I have gotten that to work.

    To eliminate any confusion I am going to explain exactly what I am trying to do. This is for a schedule of people serving on a particular day. Just to pick a day I will choose Oct 4.

    I have a table called 'Oct 4' that has two fields 'department' and 'name'. There are like 12 different departments and each has at least 2 names of people that are serving in that department on any particular day.

    The simple way to do this would be to just display department & name for each record, sort it by the department name, and list them down the page. However if there is multiple people serving in one department I only want to show the department heading once, then the names. I don't really need to get the department headings from the database, those can just be on the page itself.

    This is the code below id what I am using for one section of this 'Childrens Ministry'. It works, except it is only showing one result under one heading. If I put this inside a repeat region, it will repeat the whole entire list of headings, including the next record in the list.

    Code:
    <div align="center"><strong>CHILDREN</strong><br />
    Nursery: <br />
    <?php
    
    if($row_Recordset1['department'] == 'Nursery') {
    
    echo $row_Recordset1['names']."</p>";
    
    }?>
    <br />
    Baby Ministers:<br />
    <?php
    
    if($row_Recordset1['department'] == 'Baby Minister') {
    
    echo $row_Recordset1['names']."</p>";
    
    }?>
    <br />
    Pre Wee Church<br />
    <?php
    
    if($row_Recordset1['department'] == 'Pre Wee Church') {
    
    echo $row_Recordset1['names']."</p>";
    
    }?>
    <br />
    Wee Church<br />
    <?php
    
    if($row_Recordset1['department'] == 'Wee Church') {
    
    echo $row_Recordset1['names']."</p>";
    
    }?>
    <br />
    Childrens Church<br />
    <?php
    
    if($row_Recordset1['department'] == 'Childrens Church') {
    
    echo $row_Recordset1['names']."</p>";
    
    }?>
    </div>
    This seems like it should be working, it is weird that it will not. To give a better idea here is a couple links to help visualize the results I am getting.

    Withou the 'repeat region': http://www.living-waters.net/schedul...put/date01.php

    With the 'repeat region': http://www.living-waters.net/schedul...e01_repeat.php

  4. #14
    Join Date
    Jan 2009
    Posts
    17
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Nevermind on trying to get this approach to work. I have decided to go a slightly different way. I am going to have all the date (dept, names, dates) and just call those out with a simple search page, rather than trying to display them all at once.

    Thanks for everyone's insight.

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
  •