ID:               29932
 Updated by:       [EMAIL PROTECTED]
 Reported By:      joshua dot montgomery at middlebrow dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Debian
 PHP Version:      4.3.8
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

.


Previous Comments:
------------------------------------------------------------------------

[2004-09-01 17:47:00] joshua dot montgomery at middlebrow dot com

Description:
------------
We fixed this bug by setting Register_Globals to "Off", but we were
also making other changes on the server to solve it, so that might not
have been the fix.

We are using the following code to store database entries in memory for
use later on in the page

When allocating memory for an array dynamically using a sql_query the
values came out as strings, rather than arrays.

I took all of the error checking out of the code below to make it more
clear.  We use this code to dump an array to a select menu creation
function.

It should be noted that this bug doesn't always appear, but seems to be
produced for larger arrays (10 - 25) rather than arrays containing 2 or
3 entries.

It should also be noted that adding the statement "$ArrayVariable =
array()" before the following code also solves the problem.



Reproduce code:
---------------
$rslt = mysql_query("SQL....")
$i = 0;
while ($row = mysql_fetch_array($rslt)) {

$ArrayVariable[$i]['Value'] = $row['SQL_Text Value'];
$ArrayVariable[$i]['Label'] = $row['SQL_Text Label'];
$i++;

}

print_r($ArrayVariable);

Expected result:
----------------
Array
(
    [0] => Array
        (
            [Value] => 145
            [Label] => Adair, Kris
        )

    [1] => Array
        (
            [Value] => 20
            [Label] => Bailey, Wayne
        )

    [2] => Array
        (
            [Value] => 22
            [Label] => Bartos, Alan
        )

    [3] => Array
        (
            [Value] => 24
            [Label] => Beatty, Marsha
        )
)

Actual result:
--------------
Array
(
    [0] => 1A

    [1] => 2B

    [2] => 2B

    [3] => 2B
)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29932&edit=1

Reply via email to