Jump to content

shannonp

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

shannonp's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I decided to give it another go and I worked it out. For everyone out there who is interested in the code, here it is: <snip> <?php $color1 = "#FFFF99"; $color2 = "#FFFFFF"; $row_count = 0; ?> <table border="1"> <tr> <td>fieldtitle1</td> <td>fieldtitle2</td> </tr> <?php do { ?> <tr> <?php $row_color = ($row_count % 2) ? $color1 : $color2; { $row_count++; }?> <td bgcolor="<?php echo $row_color; ?>"><?php echo $row_comp['fieldresult1']; ?> </td> <td bgcolor="<?php echo $row_color; ?>"><?php echo $row_comp['fieldresult2']; ?></td> </tr> <?php } while ($row_comp = mysql_fetch_assoc($comp)); ?> </table> </snip> As you can see, the code is (almost) identicle to whats in the tutorial on this site ( http://www.phpfreaks.com/tutorials/5/0.php ) except that I have modified it to fit in with the DW coding. Shannon
  2. I wish it was that simple!! I want to use 2 colours with an unknown amount of rows. Shannon
  3. Hi all, I've been trying to do alternating coloured rows with DW, PHP and Mysql. I've tried following the tutorial on this site plus a few other sthat I've come across but none seem to be working. I gather it has something to do with the fact that DW does a '<?php do {' statement followed by the table info finally follwed by the 'while' statement to perform a repeating region. I have tried various combinations of code but still nothing....can anyone help? I have included the code for the table just in case: <snip> <table border="1"> <tr> <td>fieldtitle1</td> <td>fieldtitle2</td> </tr> <?php do { ?> <tr> <td><?php echo $row_comp['fieldresult1']; ?></td> <td><?php echo $row_comp['fieldresult2']; ?></td> </tr> <?php } while ($row_comp = mysql_fetch_assoc($comp)); ?> </table> </snip> Cheers, Shannon
×
×
  • 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.