NYCPHP Meetup

[nycphp-talk] every other record

tedd tedd at sperling.com
Sun Feb 5 14:13:58 EST 2006


>See above for sorting rules, but I just want to say that a pet peeve of mine
>is text-entries in the db for boolean logic.  Why not something like odd=0
>|| odd=1?

Oh, why didn't you ask?

Try this:

<?php
for ($i = 1; $i <= 10; $i++)
	{
	echo($i & 1);
	echo("<br/>");
	}
?>

If you count the records, then just run that count (i.e., $i) through 
the above to determine odd = 1 for odd and odd = 0 for even.

HTH's.

tedd
-- 
--------------------------------------------------------------------------------
http://sperling.com/



More information about the talk mailing list