Eiolon Posted November 7, 2007 Share Posted November 7, 2007 I am having problems repeating in the "Availability" column. The result which goes in the column is done in the math below the query so its not in the recordset. How would I get this information to repeat? Currently, it lists the same value as the first record called "Test Program". I have attached a photo to make it a little clearer. Thanks! <?php # /programs/index.php // Connect to the MySQL server and database. require_once('../mysql_connect.php'); // Query the database for user information. $query_programs = "SELECT program_id, program_name, DATE_FORMAT(program_date, '%M %e, %Y at %l:%i %p') as convdate, program_coordinator, program_seats, program_registered FROM programs"; $programs = mysql_query($query_programs) OR die ('Cannot retrieve program information.'); $row_programs = mysql_fetch_array($programs); $number1 = $row_programs['program_seats']; $number2 = $row_programs['program_registered']; $seats = $number1 - $number2; // Close the database connection. mysql_close(); ?> <table width="100%" border="0" cellspacing="1" cellpadding="6" bgcolor="#CCCCCC"> <tr bgcolor="#E5E5E5"> <td><strong>Program</strong></td> <td><strong>Date & Time</strong></td> <td><strong>Availability</strong></td> <td><strong>Coordinator</strong></td> </tr> <?php do { ?> <tr bgcolor="#FFFFFF"> <td><a href="program.php?program_id=<?php echo $row_programs['program_id'] ?>"><?php echo $row_programs['program_name'] ?></a> </td> <td><?php echo $row_programs['convdate'] ?></td> <td><?php echo $seats ?> seats remaining</td> <td><?php echo $row_programs['program_coordinator'] ?></td> </tr> <?php } while ($row_programs = mysql_fetch_array($programs)); ?> </table> Link to comment https://forums.phpfreaks.com/topic/76449-solved-problem-repeating-data-in-a-column/ Share on other sites More sharing options...
Daukan Posted November 7, 2007 Share Posted November 7, 2007 try changing <?php <?php echo $seats ?> ?> to <?php <?php echo $row_programs['program_seats']?> ?> Link to comment https://forums.phpfreaks.com/topic/76449-solved-problem-repeating-data-in-a-column/#findComment-387165 Share on other sites More sharing options...
Daukan Posted November 7, 2007 Share Posted November 7, 2007 Ahh I see what you are trying to do. You need to do the math in the do while loop or else it will never change. Link to comment https://forums.phpfreaks.com/topic/76449-solved-problem-repeating-data-in-a-column/#findComment-387167 Share on other sites More sharing options...
Eiolon Posted November 7, 2007 Author Share Posted November 7, 2007 Ahh I see what you are trying to do. You need to do the math in the do while loop or else it will never change. Ah, I understand now. Thanks for that, works perfect Link to comment https://forums.phpfreaks.com/topic/76449-solved-problem-repeating-data-in-a-column/#findComment-387172 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.