php - Alternating table row background colors on a dynamic table -


i have table generated foreach loop.

before loop, create $iteration = 0. @ beginning of loop increments $iteration.

then this:

if($iteration % 2 == 0) {    $greyrow = 'css grey row';  } 

i've 3 rows, @ max, test with, seems greys 2nd , 3rd row under current rule, rather second.

perhaps need have else statement set other color on odd rows. not quite sure without seeing more of implementation.

if ($iteration % 2 == 0) {     $css = 'css grey row'; } else {     $css = 'css white row'; } 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -