Jump to content


Photo

Color change issues?


  • Please log in to reply
2 replies to this topic

#1 Codeman0013

Codeman0013
  • Members
  • PipPip
  • Member
  • 20 posts
  • LocationCentral Illinois USA

Posted 05 September 2006 - 01:12 PM

Hey guys the following code is supposed to alternate colors on a q and a thing but for some reason its not working? I took this page over and i'm still trying to get all the bugs worked out here is the code:


    <?php if ($totalRows_rs_employeeinfo > 0) { // Show if recordset not empty ?>
<?php
  while (!$rs_employeeqa->EOF) {
?>
     
      <tr class="
  
<?php
if($SSAdv_m1%$SSAdv_change_every1==0 && $SSAdv_m1>0){
$SSAdv_k1++;
}
print $SSAdv_colors1[$SSAdv_k1%count($SSAdv_colors1)];
$SSAdv_m1++;
?>">
          <td valign="top" width="175"><p><b><?php echo $rs_employeeqa->Fields('staffquestion'); ?></b></p></td>
          <td valign="top"><p><?php echo $rs_employeeqa->Fields('staffanswer'); ?></p></td>
      </tr>
      

	  <?php
    $rs_employeeqa->MoveNext();
  }
?>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_rs_employeeqa == 0) { // Show if recordset empty ?>

Remember to always look for those dang ; they can be a killer!

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 05 September 2006 - 01:32 PM

What exactly are you coloring in the row?  Normally when I alternate row colors, I color the actual <td> elements, not the <tr>.

When you say it's not working, is it just not coloring the rows or are you getting an error?  Have you looked at the HTML code once the page is created to make sure that the output is what you expect?

Info: PHP Manual


#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 05 September 2006 - 01:32 PM

Run it. View the source of the generated html code. Look at the class definitions for the question and answer rows and ensure those are defined in a style file that's loaded when this page is called.
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users