List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:August 31 2010 6:24pm
Subject:RE: Even or Odds numbers
View as plain text  
Not sure what you're trying to do, but if all you want to do is toggle
between two things (as in row color zebra stripes or something) then I
would suggest you not use some MOD() routine and instead just flip a
boolean.

For example in PHP just do:

	<tr class="<?= ($r == !r) ? 'light' : 'dark' ?>">  

just sayin'.

> -----Original Message-----
> From: Mike Blezien [mailto:mickalo@stripped] 
> Sent: Tuesday, August 31, 2010 11:13 AM
> To: jcboget@stripped
> Cc: MySQL List
> Subject: Re: Even or Odds numbers
> 
> ----- Original Message ----- 
> From: "Christoph Boget" <christoph.boget@stripped>
> To: "Mike Blezien" <mickalo@stripped>
> Cc: "MySQL List" <mysql@stripped>
> Sent: Tuesday, August 31, 2010 1:06 PM
> Subject: Re: Even or Odds numbers
> 
> 
> >> is there a function, using MySQL 5.0v, that can detect if 
> a numerical value
> >> is either an Even or Odd number
> >
> > MOD()
> >
> > 
> http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.
> html#function_mod
> >
> > SELECT MOD( X, 2 )
> >
> > where X is your number (or column name).  If 0, it's even 
> if 1 it's odd.
> >
> > thnx,
> > Christoph
> >
> 
> Thanks that should do the trick. Appreciate the other 
> response too. Big help :)
> 
> Mike(mickalo)Blezien
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Thunder Rain Internet Publishing
> Custom Programming & Web Hosting Services
> http://www.thunder-rain.com/
> Office: 1.712.395.0670
> Skype Contact: cgimickalo
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/mysql?unsub=1
> 

Thread
Even or Odds numbersMike Blezien31 Aug
  • RE: Even or Odds numbersJay Blanchard31 Aug
  • Re: Even or Odds numbersChristoph Boget31 Aug
  • Re: Even or Odds numbersMike Blezien31 Aug
    • RE: Even or Odds numbersDaevid Vincent31 Aug