Jump to content

[SOLVED] Problem repeating data in a column


Eiolon

Recommended Posts

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>

 

php.gif

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.