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 mailto:tedd.sperl...@gmail.comtedd.sperl...@gmail.com wrote: government rant -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,

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 tedd.sperl...@gmail.com 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

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 jschu...@sportimport.de 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

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 tedd.sperl...@gmail.com wrote: government rant -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

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

2010-05-03 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 [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-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 solution was the least

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 dae...@daevid.com 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,

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 far as I could

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 tr style=\background-color:.$tr.\; ... Don't do this modulus (%) math Just toggle a boolean!! tr class=?= ($r = !$r) ? dataRow1 : dataRow2; ? smime.p7s Description: S/MIME cryptographic signature

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!! tr class=?= ($r = !$r) ? dataRow1 : dataRow2; ? [/snip] What is wrong with modulus math Modulus is the most elegant solution I reckon. Imagine if you only

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. tr bgcolor={cycle values=#ee,#d0d0d0}

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

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. tr bgcolor={cycle

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 projects. ;-} Or if

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

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. -Original

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 least complex, as far as

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

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-29 Thread Juan Rodriguez Monti
2010/4/29 tedd tedd.sperl...@gmail.com: 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

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 tedd.sperl...@gmail.com: 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

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

2010-04-29 Thread shiplu
$a=0; while (++$a, $row=mysql_fetch_...){ echo tr class=‌‌\alternate-row-.($a%2).\... } 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

[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 html; echo head; echo 'link

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 = Here

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 tr style=\background-color:.$tr.\;

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

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 j...@rodriguezmonti.com.ar wrote: Hello Guys, I would like to implement a two color row table for some queries that I'm

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 j...@rodriguezmonti.com.ar wrote: Hello Guys, I

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

2010-04-28 Thread Juan Rodriguez Monti
2010/4/28 Jay Blanchard jblanch...@pocket.com: [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)?

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 tr style=\background-color:.$tr.\; ... Replace the hex values with the colors you desire. Just one more question about this. I'm getting something like

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 'tr style:background-color:'.$color[$i%2]... regards Jochen Jay Blanchard schrieb: [snip] Before your table; $trColor = 0; Then during the loop; while(foo){ $tr = (0 == $trColor % 2)? #E8E8E8 : #FF; echo tr

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

2010-04-28 Thread Juan Rodriguez Monti
2010/4/28 Jay Blanchard jblanch...@pocket.com: [snip] Before your table; $trColor = 0; Then during the loop; while(foo){ $tr = (0 == $trColor % 2)? #E8E8E8 : #FF; echo tr style=\background-color:.$tr.\; ... Replace the hex values with the colors you desire. Just one more

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 Fernando
What about this: $color = even; while ($row = while condition )) { $color = ($color == even) ? odd : even; echo (tr class=\$color\); echo td$row[0]/tdtd$row[1]/td td$row[2]/tdtd$row[3]/tdtd$row[4]/td ; echo (/tr) } And have two classes in your style sheet that

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'll

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 (tr class=\$color\); echo td$row[0]/tdtd$row[1]/td td$row[2]/tdtd$row[3]/tdtd$row[4]/td ;

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

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: On

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

2010-04-28 Thread Juan Rodriguez Monti
2010/4/28 Fernando ferna...@ggtours.ca: What about this: $color = even; while ($row = while condition )) {       $color = ($color == even) ? odd : even;       echo (tr class=\$color\);       echo td$row[0]/tdtd$row[1]/td  td$row[2]/tdtd$row[3]/tdtd$row[4]/td  ;       echo (/tr) } And

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'd be

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 j...@rodriguezmonti.com.ar 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 :