Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Recordset repeat regions

$
0
0
Bit of a newbie here, so apologies if I'm not quite using the correct terms, but I'm still learning!

I have am creating a site of numerous pages on which each page has a hidden div containing a glossary. Revealing the div will show two columns with 6 items on each column.

The glossary items are in a MySQL database called glossary, with field term_id, term and definition. The code I have so far is below, but the problem with this is that the results are in rows ie like this:

1 2
3 4
5 6

when I need it to be

1 4
2 5
3 6

PHP Code:

<?php
$Recordset1_endRow 
0;
$Recordset1_columns 2// number of columns
$Recordset1_hloopRow1 0// first row flag
do {
    if(
$Recordset1_endRow == 0  && $Recordset1_hloopRow1++ != 0) echo "<tr>";
   
?>
    <td></td>
    <td width="260" align="left" valign="top"><?php echo $row_Recordset1['term']; ?>:</td>
    <td width="10">&nbsp;</td>
    <td width="550"><?php echo $row_Recordset1['definition']; ?></td>
    <td width="3">&nbsp;</td>
    <?php  $Recordset1_endRow++;
if(
$Recordset1_endRow >= $Recordset1_columns) {
  
?>
  </tr>
  <?php
 $Recordset1_endRow 
0;
  }
} while (
$row_Recordset1 mysql_fetch_assoc($Recordset1));
if(
$Recordset1_endRow != 0) {
while (
$Recordset1_endRow $Recordset1_columns) {
    echo(
"<td>&nbsp;</td>");
    
$Recordset1_endRow++;
}
echo(
"</tr>");
}
?>


Viewing all articles
Browse latest Browse all 13329

Trending Articles