Re: Using a loop on a result destroys array??

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

 



On Wednesday 24 November 2004 20:31, Mark Benson wrote:

> From the above code,

Actually the above code would result in a parse error. There are no 
where-loops in PHP but there are while-loops. This is not being pedantic. If 
you're going to post code, make sure it's verbatim by using "copy and paste" 
your actual code. You want people to focus on your real problem and not on 
the mistakes you made in transcribing your actual code into your post.

> loop 2 returns a blank array, the output is simply 
> "Array ()". If I remove the loop (by commentiung it out) that extracts
> $crab the mysql $result array is suddenly full of the correct values. It
> seems to me that loop 1 is destroying or somehow not resetting $result.
> Very odd...

mysql_data_seek() is what you need. Or you can consider storing the results 
into an array the first time round then you can read results from the array 
whenever next you need it.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
Business is a good game -- lots of competition and minimum of rules.
You keep score with money.
  -- Nolan Bushnell, founder of Atari
*/

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