RE: Accessing data from next row? (mysql)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No. Try putting everything into an array and then working with that
array afterwards.

While($row = mysql_fetch_array($result))
{ $a[] = $row['column']; }

Then work with $a, which will have all the values.

---John Holmes...

> -----Original Message-----
> From: Leif K-Brooks [mailto:eurleif@buyer-brokerage.com]
> Sent: Monday, October 14, 2002 3:47 AM
> To: holmes072000@charter.net
> Cc: php-db@lists.php.net
> Subject: Re:  Accessing data from next row? (mysql)
> 
> I know that, but what if I need to access data from the next row?  If
I
> have 3 rows, is there a way to access something from row 3 while the
> loop is in row 2, but still have the loop go to row 3 when it's done
> with row 2?
> 
> John W. Holmes wrote:
> 
> >>Using mysql, how do I access the data of the next row using code
> >>something like this:
> >>$result = mysql_query("select column from table where
> >>whatever='whatever'");
> >>while($array = mysql_fetch_array($result)){
> >>//Whatever
> >>}
> >>
> >>
> >
> >Each iteration of the while loop will fetch a row for you and it's
> >contents will be in the $array[] array. Try "echo $array['column'];"
> >inside of your while to see what I'm talking about.
> >
> >---John Holmes...
> >
> >
> >
> >
> >
> 
> --
> The above message is encrypted with double rot13 encoding.  Any
> unauthorized attempt to decrypt it will be prosecuted to the full
extent
> of the law.
> 




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux