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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.