Hi Dave,
I'm still working on a way to display the schedule of classes and have done so (using your suggestion) by creating a new Section called "Schedule of Classes" (class_dates). The 'manager' will have to add each class name and date, in date format, as well as a 'display date' of the class (in some cases many times). It was the only way I could get the class dates to list properly. You can see this at:
http://alamedacountysheriff.org/_rtc2009/classes/scheduleList.php What I need to do now is figure out a way to show the dates, using the 'display date' textfield (display_date) in a box at the bottom of the class discription page. Now that I have all the dates in their own table (class_dates), I figured I could compare the class name (name) in the class table (evoc, in this case) with the name in the class_dates table (also called 'name') and if it is the same, list the date; if not, skip and go to the next record in the table until the end of the table is reached.
This is what I'm using and all it does is give me a list of the same [first] date listed in the class_dates table:
<?php foreach ($class_datesRecords as $record): ?>
<?php if ($record['name'] == $evocRecord['name']) ?>
<?php echo $class_datesRecord['display_date'] ?><br/>
<?php endforeach ?>
You can see that here:
http://alamedacountysheriff.org/_rtc2009/classes/evoc/evocDetail.php?1-Day-EVOC-Basic-Skills-Update-5 It isn't going to the next record to compare 'name' but seems to loop through the entire table. The number of dates listed (all the same) agree with the number of the same name class; just not the correct date for that record. I looked in php.net at 'do-while' and 'while' thinking that would help me loop through the table but I just couldn't get any of the examples to work with what I have.
Any suggestions?
TIA!
Eric
[:)] UPDATE:
I finally figured out how to get the dates to list the correct way (link #2 above)! It was a case sensitive issue; some of the 'name' was all caps so I used the strtoupper function:
<?php if (strtoupper($record['name']) == strtoupper($evocRecord['name'])): ?>
<?php echo $record['display_date'] ?> /<?php echo $record['seats'] ?><br/>
<?php endif ?>
Now if I can figure out how to use a value ('name') to loop through the records of a table to retrieve only those records that equal the 'name' value. The record taken from the table contains the 'name' value and I want to use that value to loop through the rest of the records (from the top) and get only those records that equal the 'name' value. I tried initializing it first ($staticrec = $class_datesRecord['name'];) at the top and then used the following to loop through the table:
<?php foreach ($class_datesRecords as $staticrec => $record): ?>
<?php echo $record['display_date'] ?><br/>
<?php endforeach ?>
But it only showed one date and there are several for the same 'name'.
Any suggestions?
Eric
[:)] LAST UPDATE:
Got it working! It was (I think) a matter of changing from a multi to a category type section (don't know why I chose multi to start with). If you click on the links above you'll see the dates for that particular class are now listed properly.