Re: mysql_fetch_array() indices
| From: | Lars Torben Wilson | Date: | Tue, 13 Apr 1999 18:13:08 +0000 |
| Subject: | Re: mysql_fetch_array() indices | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-5037@lists.php.net to get a copy of this message | ||
So does anyone mind if I commit this?
Torben
Lars Torben Wilson writes:
>
> Howdy,
>
> A little while a nifty patch was applied which allows
> mysql_fetch_array() to provide numeric indices, assoc. indices, or
> both. However, the patch also reversed the order of the returned
> elements when both types are used. Since it seems that people are
> using next() to iterate over the returned data, there wouldn't seem to
> be any harm in retaining the old order, if only for backward
> compatibility.
>
> Here's a submission for a quick patch to get back the old order.
>
>
> Cheers,
>
> Torben
>
>
> Index: functions/mysql.c
> ===================================================================
> RCS file: /repository/php3/functions/mysql.c,v
> retrieving revision 1.180
> diff -u -r1.180 mysql.c
> --- functions/mysql.c 1999/02/27 19:10:38 1.180
> +++ functions/mysql.c 1999/04/12 18:00:37
> @@ -1495,12 +1495,12 @@
> data_len = mysql_row_lengths[i];
> should_copy=1;
> }
> + if (result_type & MYSQL_NUM) {
> + add_index_stringl(return_value, i, data, data_len, should_copy);
> + }
> if (result_type & MYSQL_ASSOC) {
> add_assoc_stringl(return_value, mysql_field->name, data, data_len, should_copy);
> should_copy=1;
> - }
> - if (result_type & MYSQL_NUM) {
> - add_index_stringl(return_value, i, data, data_len, should_copy);
> }
> } else {
> /* NULL field, don't set it */
>
> --
> PHP Development Mailing List http://www.php.net/
> To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
> For help: php-dev-help@lists.php.net
>
>
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net