Re: [PHP-DB] Current row of query

2002-09-26 Thread Patrick Lebon
Thanks for your help. As i said im quite new to php so all your help in simplifying my code has been appeciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] Current row of query

2002-09-26 Thread John Holmes
> Is there a mysql or array variable for the current row of a query array? > I want to alternate background colours for each row of the query output so > i > need to know the current row number. There is a way with SQL variables, but you're better off just letting PHP keep track of it. ---John H

RE: [PHP-DB] Current row of query

2002-09-26 Thread John Holmes
[mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 26, 2002 11:42 AM > To: 'Patrick Lebon'; [EMAIL PROTECTED] > Subject: RE: [PHP-DB] Current row of query > > > -Original Message- > > From: Patrick Lebon [mailto:[EMAIL PROTECTED]] > > Sent: 26 Septembe

RE: [PHP-DB] Current row of query

2002-09-26 Thread Ford, Mike [LSS]
> -Original Message- > From: Patrick Lebon [mailto:[EMAIL PROTECTED]] > Sent: 26 September 2002 16:20 > > This is how im currently doing it... > > $rowNum = 0; > while ( $row = mysql_fetch_array($result) ) > { > $rowNum++; > if ($rowNum % 2) { $bgCol = "#EADBC6"; } else { $bgCol = "

Re: [PHP-DB] Current row of query

2002-09-26 Thread Brad Bonkoski
Last I checked there was no way to retrieve the current index into the result array, you can set the index manually with mysql_seek_data(), but I don't think that is what you want, so the best solution IMHO, is to do what you are doing and manually keep track of the index. -Brad Patrick Lebon wro

Re: [PHP-DB] Current row of query

2002-09-26 Thread Brad Bonkoski
I want it to. > > > -Original Message- > > From: Brad Bonkoski [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, September 26, 2002 11:10 AM > > To: Patrick Lebon; [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] Current row of query > > > > > >

Re: [PHP-DB] Current row of query

2002-09-26 Thread Patrick Lebon
Thanks, im currently doing something similar to this but I was wondering if there was an already defined variable that i could use rather then have to create a value and increment it myself. I guess am being picky, but was just curious as im new to php. This is how im currently doing it... $row

RE: [PHP-DB] Current row of query

2002-09-26 Thread Hutchins, Richard
rying to figure out why the code works, but not the way I want it to. > -Original Message- > From: Brad Bonkoski [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 26, 2002 11:10 AM > To: Patrick Lebon; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Current row of query > &g

Re: [PHP-DB] Current row of query

2002-09-26 Thread Adam Williams
why not if (!($1%2)) { echo "even!"; } else { echo "odd!"; } Adam On Thu, 26 Sep 2002, Brad Bonkoski wrote: > oops... > > I meant: > (if $i is odd) > ... > > because $i would be the current index in the array. > > > Brad Bonkoski wrote: > > > why not this? > > > > $result = mys

Re: [PHP-DB] Current row of query

2002-09-26 Thread Brad Bonkoski
oops... I meant: (if $i is odd) ... because $i would be the current index in the array. Brad Bonkoski wrote: > why not this? > > $result = mysql_query("Select * from table'); > $num_rows = mysql_num_rows($rows); > > for ($i=0; $i<$num_rows, $i++) > { > $row = mysql_fetch_array($result); >

Re: [PHP-DB] Current row of query

2002-09-26 Thread Brad Bonkoski
why not this? $result = mysql_query("Select * from table'); $num_rows = mysql_num_rows($rows); for ($i=0; $i<$num_rows, $i++) { $row = mysql_fetch_array($result); if ($num_rows is odd) { print $row with BG color of red; } else { printf $row with BG color o