Image

Imagemonotonehell wrote in Imagephp

It's the simple things in life...

Most of you are probably already doing this. But you never know.

Function to call to mark up table rows with CSS
// odd_even
	// marks up table rows odd or even
	// returns string to echo
function odd_even ($count) {
	if ($count & 1) {
		return ' class="odd" ';
	} else {
		return ' class="even" ';
	}
}

And then...
	$count = 0;
		while ($row1 = mysql_fetch_array ($result1, MYSQL_ASSOC)) {
			$count++;
			echo '<tr',odd_even($count),'><td> ** table row data ** </td>';

...etc


Until I thought this little guy up I've been stupidly sticking the same routine in manually each time. It's the little things I often overlook.