Re: [PHP] Two color rows in table inside while iteration [X-PHP]

2010-05-06 Thread Michiel Sikma
On 6 May 2010 17:47, tedd wrote: > > > Michiel: > > Considerate? Being Inconsiderate is what the government does for a living. > > Additionally, what you said above is *your* opinion -- as *you* presented > in a public forum. Who's opinion is more appropriate for this list is > subject to debate.

Re: [PHP] Two color rows in table inside while iteration [X-PHP]

2010-05-06 Thread tedd
At 12:07 AM +0200 5/6/10, Michiel Sikma wrote: On 2 May 2010 19:11, tedd <tedd.sperl...@gmail.com> wrote: -snip- Yes, it would be nice if the people who work for the government also had to live under the same rules as the rest of us. As it is, they live in a

Re: [PHP] Two color rows in table inside while iteration [X-PHP]

2010-05-05 Thread Michiel Sikma
On 2 May 2010 19:11, tedd wrote: > > > > -snip- > Yes, it would be nice if the people who work for the government also had to > live under the same rules as the rest of us. As it is, they live in a state > of privilege enjoying salaries that are typically 175 percent above that of > the private

Re: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-05-05 Thread Michiel Sikma
On 3 May 2010 08:25, Jochen Schultz wrote: > > [snip] > > And unless we are adding a multiple seconds to the load time is anyone >> going to notice a difference of 1 second? >> > > yes > > > It's really not that big a deal. http://pastie.org/947121 Personally, I think using modulus is as nice a

Re: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-05-02 Thread Jochen Schultz
> [snip] And unless we are adding a multiple seconds to the load time is anyone going to notice a difference of 1 second? yes regards Jochen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Two color rows in table inside while iteration

2010-05-02 Thread Nathan Rixham
Paul M Foster wrote: > On Fri, Apr 30, 2010 at 01:52:25PM -0400, tedd wrote: > >> At 10:34 AM -0400 4/30/10, Paul M Foster wrote: >>> On Thu, Apr 29, 2010 at 05:34:38PM -0400, tedd wrote: >>> >>> > Please critically review my example. >>> >>> +1 >>> >>> This thread came up before, and tedd's solu

Re: [PHP] Two color rows in table inside while iteration [X-PHP]

2010-05-02 Thread tedd
At 11:53 PM -0400 5/1/10, Paul M Foster wrote: On Fri, Apr 30, 2010 at 01:52:25PM -0400, tedd wrote: > All the code I provide on this list and on my various web sites is for free for anyone, except for "governments" (i.e., local, state, federal, other), to use, review, and/or comment as they

Re: [PHP] Two color rows in table inside while iteration

2010-05-01 Thread Paul M Foster
On Fri, Apr 30, 2010 at 01:52:25PM -0400, tedd wrote: > At 10:34 AM -0400 4/30/10, Paul M Foster wrote: >> On Thu, Apr 29, 2010 at 05:34:38PM -0400, tedd wrote: >> >> > Please critically review my example. >> >> +1 >> >> This thread came up before, and tedd's solution was the least complex, >> as

Re: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-05-01 Thread Richard Quadling
On 30 April 2010 21:20, Daevid Vincent wrote: >> -Original Message- >> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] >> >> Modulus is the most elegant solution I reckon. Imagine if you only >> needed to highlight every 3rd row, or 4th? Easy to change the modulus >> for it, not s

Re: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-04-30 Thread Jason Pruim
On Apr 30, 2010, at 4:20 PM, Daevid Vincent wrote: -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Modulus is the most elegant solution I reckon. Imagine if you only needed to highlight every 3rd row, or 4th? Easy to change the modulus for it, not so easy to

Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Ashley Sheridan
On Fri, 2010-04-30 at 15:59 -0400, tedd wrote: > At 7:26 PM +0100 4/30/10, Ashley Sheridan wrote: > >>On Fri, 2010-04-30 at 13:59 -0400, tedd wrote: > >>At 4:37 PM +0200 4/30/10, Jay Ess wrote: > >>>Paul M Foster wrote: > +1 > > This thread came up before, and tedd's solution was the

RE: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-04-30 Thread Daevid Vincent
> -Original Message- > From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] > > Modulus is the most elegant solution I reckon. Imagine if you only > needed to highlight every 3rd row, or 4th? Easy to change the modulus > for it, not so easy to re-work a binary switch. > > -Origin

Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread tedd
At 7:26 PM +0100 4/30/10, Ashley Sheridan wrote: On Fri, 2010-04-30 at 13:59 -0400, tedd wrote: At 4:37 PM +0200 4/30/10, Jay Ess wrote: Paul M Foster wrote: +1 This thread came up before, and tedd's solution was the least complex, as far as I could tell. I shamelessly stole his code and regul

Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Ashley Sheridan
On Fri, 2010-04-30 at 13:59 -0400, tedd wrote: > At 4:37 PM +0200 4/30/10, Jay Ess wrote: > >Paul M Foster wrote: > >>+1 > >> > >>This thread came up before, and tedd's solution was the least complex, > >>as far as I could tell. I shamelessly stole his code and regularly use > >>it in my own proje

Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread tedd
At 4:37 PM +0200 4/30/10, Jay Ess wrote: Paul M Foster wrote: +1 This thread came up before, and tedd's solution was the least complex, as far as I could tell. I shamelessly stole his code and regularly use it in my own projects. ;-} Or if one choose to use Smarty template. http://www.smart

Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread tedd
At 10:34 AM -0400 4/30/10, Paul M Foster wrote: On Thu, Apr 29, 2010 at 05:34:38PM -0400, tedd wrote: > Please critically review my example. +1 This thread came up before, and tedd's solution was the least complex, as far as I could tell. I shamelessly stole his code and regularly use it in m

Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Jay Ess
Paul M Foster wrote: +1 This thread came up before, and tedd's solution was the least complex, as far as I could tell. I shamelessly stole his code and regularly use it in my own projects. ;-} Or if one choose to use Smarty template. http://www.smarty.net/manual/en/language.function.cycle.

RE: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Ashley Sheridan
On Fri, 2010-04-30 at 06:14 -0500, Jay Blanchard wrote: > [snip] > Don't do this modulus (%) math Just toggle a boolean!! > > "> > [/snip] > > What is wrong with modulus math > Modulus is the most elegant solution I reckon. Imagine if you only needed to highlight every 3rd row, or 4th

Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Paul M Foster
On Thu, Apr 29, 2010 at 05:34:38PM -0400, tedd wrote: > At 11:01 AM -0300 4/29/10, Juan Rodriguez Monti wrote: >> >> Tedd, >> Thanks. I'm gonna check it. I finally solved it using: >> >> if ( CONDITIONS )) { >> >> $results = query( QUERY ); >> $colors = array('#97b7cd','#96bf8c'); >>

RE: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Jay Blanchard
[snip] Don't do this modulus (%) math Just toggle a boolean!! "> [/snip] What is wrong with modulus math -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Richard Quadling
On 30 April 2010 08:40, Daevid Vincent wrote: >> -Original Message- >> while(foo){ >> $tr = (0 == $trColor % 2)? "#E8E8E8" : "#FF"; >> echo ""; >> ... > > Don't do this modulus (%) math Just toggle a boolean!! > > "> > The modulus is a good option when there are more than 2 states

RE: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Daevid Vincent
> -Original Message- > while(foo){ > $tr = (0 == $trColor % 2)? "#E8E8E8" : "#FF"; > echo ""; > ... Don't do this modulus (%) math Just toggle a boolean!! "> smime.p7s Description: S/MIME cryptographic signature

Re: [PHP] Two color rows in table inside while iteration

2010-04-29 Thread shiplu
$a=0; while (++$a, $row=mysql_fetch_...){ echo "<..." } Shiplu Mokaddim My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http:

Re: [PHP] Two color rows in table inside while iteration

2010-04-29 Thread tedd
At 11:01 AM -0300 4/29/10, Juan Rodriguez Monti wrote: 2010/4/29 tedd : At 8:29 AM -0300 4/28/10, Juan Rodriguez Monti wrote: Hello Guys, I would like to implement a two color row table for some queries that I'm doing. I use PHP to query a DB, then I use while to print all its results. I

Re: [PHP] Two color rows in table inside while iteration

2010-04-29 Thread Juan Rodriguez Monti
2010/4/29 tedd : > At 8:29 AM -0300 4/28/10, Juan Rodriguez Monti wrote: >> >> Hello Guys, >> I would like to implement a two color row table for some queries that I'm >> doing. >> >> I use PHP to query a DB, then I use while to print all its results. I >> have a code pretty similar to this one : >

Re: [PHP] Two color rows in table inside while iteration

2010-04-29 Thread tedd
At 8:29 AM -0300 4/28/10, Juan Rodriguez Monti wrote: Hello Guys, I would like to implement a two color row table for some queries that I'm doing. I use PHP to query a DB, then I use while to print all its results. I have a code pretty similar to this one : $results = Here the QUERY;

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Richard Quadling
On 28 April 2010 12:29, Juan Rodriguez Monti wrote: > Hello Guys, > I would like to implement a two color row table for some queries that I'm > doing. > > I use PHP to query a DB, then I use while to print all its results. I > have a code pretty similar to this one : > >  $results = Here the QUER

RE: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Bob McConnell
From: Ashley Sheridan > On Wed, 2010-04-28 at 09:46 -0400, Fernando wrote: > >> But then you need to differentiate the table, otherwise all your tables >> will have the same row formating no? This way you only apply the >> formating to those rows that need it. > > Yes, but one would assume you

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Juan Rodriguez Monti
2010/4/28 Fernando : > What about this: > > $color = "even"; > while ($row = while condition )) { >       $color = ($color == "even") ? "odd" : "even"; >       echo (""); >       echo "$row[0]$row[1] >  $row[2]$row[3]$row[4]  "; >       echo ("") > } > > And have two classes in your style sheet tha

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Ashley Sheridan
On Wed, 2010-04-28 at 09:46 -0400, Fernando wrote: > But then you need to differentiate the table, otherwise all your tables > will have the same row formating no? This way you only apply the > formating to those rows that need it. > > Fernando. > > On 28/04/2010 09:35, Ashley Sheridan wrote:

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Fernando
But then you need to differentiate the table, otherwise all your tables will have the same row formating no? This way you only apply the formating to those rows that need it. Fernando. On 28/04/2010 09:35, Ashley Sheridan wrote: On Wed, 2010-04-28 at 09:34 -0400, Fernando wrote: What a

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Ashley Sheridan
On Wed, 2010-04-28 at 09:34 -0400, Fernando wrote: > What about this: > > $color = "even"; > while ($row = while condition )) { > $color = ($color == "even") ? "odd" : "even"; > echo (""); > echo "$row[0]$row[1] > $row[2]$row[3]$row[4] "; > echo ("") > } > > An

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Ashley Sheridan
On Wed, 2010-04-28 at 17:59 +0430, Ali Asghar Toraby Parizy wrote: > I agree with you. in this simple example we can use php but we may > need table with extra functionality and only client side scripts are > reasonable and applicable. we can create multi color and clickable > rows by php but we'l

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Fernando
What about this: $color = "even"; while ($row = while condition )) { $color = ($color == "even") ? "odd" : "even"; echo (""); echo "$row[0]$row[1] $row[2]$row[3]$row[4] "; echo ("") } And have two classes in your style sheet that format each row differently. Hope

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Ali Asghar Toraby Parizy
I agree with you. in this simple example we can use php but we may need table with extra functionality and only client side scripts are reasonable and applicable. we can create multi color and clickable rows by php but we'll have greater server load. anyway that was only an propose;-) On Wed, Apr

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Juan Rodriguez Monti
2010/4/28 Jay Blanchard : > [snip] >> Before your table; >> >> $trColor = 0; >> >> Then during the loop; >> >> while(foo){ >> $tr = (0 == $trColor % 2)? "#E8E8E8" : "#FF"; >> echo ""; >> ... >> >> Replace the hex values with the colors you desire. > > Just one more question about this. > > I'm

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Jochen Schultz
Like this? $color[0] = 'red'; $color[1] = 'blue'; for ($i=0;foo;$i++) { echo ' [snip] Before your table; $trColor = 0; Then during the loop; while(foo){ $tr = (0 == $trColor % 2)? "#E8E8E8" : "#FF"; echo ""; ... Replace the hex values with the colors you desire. Just one more question

RE: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Jay Blanchard
[snip] > Before your table; > > $trColor = 0; > > Then during the loop; > > while(foo){ > $tr = (0 == $trColor % 2)? "#E8E8E8" : "#FF"; > echo ""; > ... > > Replace the hex values with the colors you desire. Just one more question about this. I'm getting something like this[0], and I would li

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Juan Rodriguez Monti
2010/4/28 Jay Blanchard : > [snip] > I just want to show you how I write the table. What I would like to > know is what do you suggest to do a two color row format. > [/snip] > > Before your table; > > $trColor = 0; > > Then during the loop; > > while(foo){ > $tr = (0 == $trColor % 2)? "#E8E8E8" :

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Ashley Sheridan
On Wed, 2010-04-28 at 16:16 +0430, Ali Asghar Toraby Parizy wrote: > It isn't good idea to use php to visualize your table. You can fetch > you data by php and style them by java script. > > On Wed, Apr 28, 2010 at 3:59 PM, Juan Rodriguez Monti > wrote: > > Hello Guys, > > I would like to implem

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Ali Asghar Toraby Parizy
It isn't good idea to use php to visualize your table. You can fetch you data by php and style them by java script. On Wed, Apr 28, 2010 at 3:59 PM, Juan Rodriguez Monti wrote: > Hello Guys, > I would like to implement a two color row table for some queries that I'm > doing. > > I use PHP to que

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Gary .
On 4/28/10, Juan Rodriguez Monti wrote: > I would like to implement a two color row table for some queries that I'm > doing. ... > what do you suggest to do a two color row format. Well, I wouldn't mix the presentation and querying of the db in one place, but assuming that's just a simplified exam

RE: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Jay Blanchard
[snip] I just want to show you how I write the table. What I would like to know is what do you suggest to do a two color row format. [/snip] Before your table; $trColor = 0; Then during the loop; while(foo){ $tr = (0 == $trColor % 2)? "#E8E8E8" : "#FF"; echo ""; ... Replace the hex values

Re: [PHP] Two color rows in table inside while iteration

2010-04-28 Thread Ashley Sheridan
On Wed, 2010-04-28 at 08:29 -0300, Juan Rodriguez Monti wrote: > Hello Guys, > I would like to implement a two color row table for some queries that I'm > doing. > > I use PHP to query a DB, then I use while to print all its results. I > have a code pretty similar to this one : > > $results =

[PHP] Two color rows in table inside while iteration

2010-04-28 Thread Juan Rodriguez Monti
Hello Guys, I would like to implement a two color row table for some queries that I'm doing. I use PHP to query a DB, then I use while to print all its results. I have a code pretty similar to this one : $results = Here the QUERY; echo ""; echo ""; echo ''; echo "