Using DW 5.5
I am trying to loop thru a DB table. My connection to the DB works. The table has multiple fields although I'm only trying to print 2 of them; the holder of the event and the event name in a vertical column with the holder above the event name.
Result I'm trying to get should look like this:
Holder
Event name
Holder
Event name
I get the desired results but only after a repitition of the 'if....{' and the $holder == ....holder'];' lines; it appears as follows:
if ($holder != $row_getEvents['event_holder']) {}$holder == $row_getEvents['event_holder']; if ($holder != $row_getEvents['event_holder']) {}$holder == $row_getEvents['event_holder']; if ($holder != $row_getEvents['event_holder']) {}$holder == $row_getEvents['event_holder'];
The above repeats ('if' thru 'if') for the total of the number of records in the table; then it echos the Holder and Event Name lines for all the records in the table as desired.
My recordset query is: $query_getEvents = "SELECT * FROM event_schedule ORDER BY event_holder, event_date ASC"; (this obviously works because the data is there and presents in desired sequence); so, why doesn't the following produce only the data?
<body>
<h1>Manage Events</h1>
<table width="600">
<?php $holder = "holder is blank"; (I put 'holder is blank' here solely for testing, it will be null and the next line eliminated)
echo $holder; ?><br />
<?php do { ?>
if ($holder != $row_getEvents['event_holder']) {
<tr align="center" valign="top">
<td><?php echo $row_getEvents['event_holder'] . " / "; ?><br />
</td></tr>
}
<tr align="center" valign="top">
<td><?php echo $row_getEvents['event_name'] . " / "; ?><br />
</td></tr>
$holder == $row_getEvents['event_holder'];
<?php } while ($row_getEvents = mysql_fetch_assoc($getEvents)); ?>
</table>
<p> </p>
</body>
</html>
<?php
mysql_free_result($getEvents);
?>
Thanks in advance,
Tom Smith