Copy link to clipboard
Copied
I'm creating a facility for an airshow web site where volunteers can apply online and specify their preferred activity. The airport manager will then assign the volunteers to an activity and we'd like to display the list of people assigned to each activity, by day - as the airshow runs for 3 days. There are about 10 activities.
I know I could create about 30 recordsets (10 for each day) and then display the list of names for each activity in a table, but it seems to me there should be a more elegant way. I'm thinking I could create 3 recordsets, one for each day and then display a list of names sorted by volunteer name within activity. Basically I'd like to have something that looks like this for each day:
Activity 1
- name 1
- name 2
- name 3
Activity 2
- name 4
- name 5
Activity 3
- name 6
etc
I'm using DW CS4 with PHP/MySQL.
Thanks so much for any assistance before I start creating 30 recordsets.
<td valign="top"><?php
// initialize a variable to store the previous activity
$previous = ' ';
do { ?>
<?php
if ($row_rsVolunteersFriday['assignedactivity'] != $previous)
{ echo "<b>".$row_rsVolunteersFriday['assignedactivity']."</b><br>";
echo $row_rsVolunteersFriday['firstname']." ";
echo $row_rsVolunteersFriday['lastname']."<br>";
// store the current name in the $previous variable
Copy link to clipboard
Copied
You don't mention how your database is setup. If all factors are in one database table then you can use one query and filter your repeat regions. Look at this page for info on how to reuse a repeat region.
http://kb2.adobe.com/community/publishing/528/cpsid_52877.html
Then in each do/while insert an if clause where if query parameter (activity name for example) equals a value then proceed to loop those filtered results. Make sense?
Copy link to clipboard
Copied
Thanks that was helpful, I'm almost there now. I can display a list of names for each activity. The last remaining issue is that I'd like to display the activity in bold and the names in normal font. I've tried various combinations of <strong> and </strong> and usually the page then fails to load...sigh. So do you know just how I can display the activity in bold?
The page can be seen at www.hollisterairshow.com/admin/admin3.php then select the "Vol. Assignments Summary" tab and I'm working on the "Friday" column.
The code is shown below:
<td valign="top"><?php
// initialize a variable to store the previous activity
$previous = ' ';
do { ?>
<?php
if ($row_rsVolunteersFriday['assignedactivity'] != $previous)
{ echo $row_rsVolunteersFriday['assignedactivity']."<br>";
echo $row_rsVolunteersFriday['firstname']." ";
echo $row_rsVolunteersFriday['lastname']."<br>";
// store the current name in the $previous variable
$previous = $row_rsVolunteersFriday['assignedactivity'];
}
else
{ echo $row_rsVolunteersFriday['firstname']." ";
echo $row_rsVolunteersFriday['lastname']."<br>";
}
?>
<?php } while ($row_rsVolunteersFriday = mysql_fetch_assoc($rsVolunteersFriday)); ?>
</td>
Thanks so much
Tony
Copy link to clipboard
Copied
<td valign="top"><?php
// initialize a variable to store the previous activity
$previous = ' ';
do { ?>
<?php
if ($row_rsVolunteersFriday['assignedactivity'] != $previous)
{ echo "<b>".$row_rsVolunteersFriday['assignedactivity']."</b><br>";
echo $row_rsVolunteersFriday['firstname']." ";
echo $row_rsVolunteersFriday['lastname']."<br>";
// store the current name in the $previous variable
$previous = $row_rsVolunteersFriday['assignedactivity'];
}
else
{ echo $row_rsVolunteersFriday['firstname']." ";
echo $row_rsVolunteersFriday['lastname']."<br>";
}
?>
<?php } while ($row_rsVolunteersFriday = mysql_fetch_assoc($rsVolunteersFriday)); ?>
</td>
Copy link to clipboard
Copied
Perfect !! Thank you so much.