Copy link to clipboard
Copied
I have a table with a repeat region that has 2 record set. The first is the list of the data and just one of the fields uses another table to count the record_id. I nested the region and first set of records show the count and it does change if the other field is added so I know the first one is working but all other regions (other than the first one) have that field as blank.
Here is the code:
<?php do { ?>
<table wideth = "620" border = "1" id="tablen">
<tr>
<th width="54">Date</th>
<th width="60">Day</th>
<th width="60">Time</th>
<th width="148">Course</th>
<th width="56">Cost</th>
<th width="56">Signed Up</th>
<th width="51">Field</th>
<th width="93">Register</th>
</tr>
<tr>
<td><?php echo $row_getEven['even_date'];?></td>
<td><?php echo $row_getEven['round_day'];?></td>
<td><?php echo $row_getEven['time'];?></td>
<td><?php echo $row_getEven['course'];?></td>
<td><?php echo $row_getEven['player_cost'];?></td>
<? do { ?>
<td><?php echo $row_getCountp['count_even'];?></td>
<?php } while ($row_getCountp = mysql_fetch_assoc($getCountp));?>
<td><?php echo $row_getEven['register'];?></td>
</tr>
</table>
</form>
</p>
<p><img src="Images/each.jpg" width="620" height="10" /></p>
<?php } while ($row_getEven = mysql_fetch_assoc($getEven));?>
Any ideas?
Copy link to clipboard
Copied
The explanation of what you're trying to do is not at all clear. However, the code you have posted here will produce a mess.
Basically, a repeat region is a do... while loop. What it does is loop through the database results until they have all been used. Consequently, nesting two loops, as you have done, will produce the following effect:
If you want to display a value in each row, you will need to create a SQL query that joins the two tables, and use a single repeat region to loop through the results.
Copy link to clipboard
Copied
Ok, I understand the problem but I don't know how to create the recordset as I need. Let me explain.
I have a table in the database that lists courses and has ID's and whether they are active or not. I want the table to list all active (that equal 'yes') courses. Then I have another table that is called players that allows players to register for the course. I want the table to pull the count of players for each course from the players table to display on each row of each course to show how many registered for each. The course table has a game_id and so does the players table which tells me what course(s) they registered for. I tried to join the tables but kept getting errors. Any help would be appreciated.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more