mysql rereading result set (fetch_assoc)

mysql rereading result set (fetch_assoc)

am 06.01.2007 16:55:20 von lwoods

I'm running thru a result set using fetch_assoc. Now I want to run through
it again.

How?

TIA,

Larry Woods

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

Re: mysql rereading result set (fetch_assoc)

am 06.01.2007 22:12:54 von Niel Archer

Hi

> I'm running thru a result set using fetch_assoc. Now I want to run through
> it again.
>
> How?

Save each row into an array first time around, then reset the array
pointer to the beginning, would be one way.

Or assuming you're using the original MySQL functions, use
mysql_data_seek(0) to reset the internal result pointer, as one minute
scanning the function list in the documentation would tell you

Niel

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

Re: mysql rereading result set (fetch_assoc)

am 09.01.2007 12:23:05 von Niel Archer

------=_NextPart_6e7_78b6_28e44e85.539d5585_.MIX
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi

> I'm running thru a result set using fetch_assoc. Now I want to run th=
rough=20
> it again.
>=20
> How?

Save each row into an array first time around, then reset the array
pointer to the beginning, would be one way.

Or assuming you're using the original MySQL functions, use
mysql_data_seek(0) to reset the internal result pointer, as one minute
scanning the function list in the documentation would tell you

Niel

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




************************************************************ **********

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.

************************************************************ ************
<<<>>>
------=_NextPart_6e7_78b6_28e44e85.539d5585_.MIX
Content-Type: text/plain;
name="GWAVADAT.TXT"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="GWAVADAT.TXT"

AdmID:CF5D10B0ACA9C096BDA46CBF5C928697



************************************************************ **********

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.

************************************************************ ************
<<<>>>

------=_NextPart_6e7_78b6_28e44e85.539d5585_.MIX
Content-Type: text/plain; charset=us-ascii

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
------=_NextPart_6e7_78b6_28e44e85.539d5585_.MIX--

RE: mysql rereading result set (fetch_assoc)

am 10.01.2007 02:15:04 von christine

Hi, I would ask which way is more efficient and save time? Save each row to
array or mysql_data_seek(0) ?

Regards & Thanks,
Christine

-----Original Message-----
From: niel@catweasel.org [mailto:niel@catweasel.org]
Sent: Tuesday, January 09, 2007 18:23
To: php-db@lists.php.net
Subject: Re: [PHP-DB] mysql rereading result set (fetch_assoc)

Hi

> I'm running thru a result set using fetch_assoc. Now I want to run
through
> it again.
>
> How?

Save each row into an array first time around, then reset the array
pointer to the beginning, would be one way.

Or assuming you're using the original MySQL functions, use
mysql_data_seek(0) to reset the internal result pointer, as one minute
scanning the function list in the documentation would tell you

Niel

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

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

Re: mysql rereading result set (fetch_assoc)

am 10.01.2007 02:24:29 von dmagick

christine wrote:
> Hi, I would ask which way is more efficient and save time? Save each row to
> array or mysql_data_seek(0) ?

Probably mysql_data_seek(0).

That just resets the mysql pointer back to the start and so it doesn't
re-run the query or anything like that and doesn't take up any extra memory.

--
Postgresql & php tutorials
http://www.designmagick.com/

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

Re: mysql rereading result set (fetch_assoc)

am 10.01.2007 02:29:28 von Niel Archer

Hi

> Hi, I would ask which way is more efficient and save time? Save each row to
> array or mysql_data_seek(0) ?


That totally depends on which resources are more valuable to you.
The array will likely use more memory but be faster to process.
While mysql_data_seek(0) would probably use no additional memory but
be slower. It also might require you to duplicate code.

Niel

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

AW: mysql rereading result set (fetch_assoc)

am 10.01.2007 10:00:05 von spilker

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