Jump to content

Color Change problem?


Codeman0013

Recommended Posts

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="  <?phpif($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 ?>

Link to comment
Share on other sites

Try something like this:

<?$query = "SELECT * FROM table order by name";$results = mysql_query($query);$i = 1;while($e = mysql_fetch_array($results)){ ?>  <tr    <? 	if ($i % 2 == 0){	 echo "bgcolor='transparent'"; 	} else { 	 echo "bgcolor='#F0F0F0' style='color:#7E7E7E;filter:alpha(opacity=70);-moz-opacity: 0.70;opacity: 0.70;-khtml-opacity: 0.70;'";}    ?>>   <td><? echo "<a href='nominationforms/$e[nom_doc]' class='links'>". $e[nom_title]." ".$e[nom_first]." ".$e[nom_middle]." ".$e[nom_last]."</a>"; ?></td>   <td><? echo $e[nom_tenure]; ?></td>   <td><? echo $e[nom_ret_date]; ?></td>   <td><? echo $e[nom_years]; ?></td>  </tr> <? $i = $i + 1;}?>

Link to comment
Share on other sites

Hey guys the following code is supposed to alternate colors on a q and a thing but for some reason its not working?
Is that a question?
I took this page over and i'm still trying to get all the bugs worked out here is the code:
Look at the HTML that is being generated to figure out what the problem is. You are displaying a value from an array called $SSAdv_colors1, but there's no way to tell from this code if the value in that array is valid. For all we know, you are displaying a hex color code in the "class" attribute. Look at the HTML and see why it's not working, then you can change the PHP to display the correct HTML.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...