Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #41058 : Difference in syntax for mysql_fetch_array
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 17th July 13:10
php-bugs
External User
 
Posts: 1
Default #41058 : Difference in syntax for mysql_fetch_array



From: mattsoghoian at gmail dot com
Operating system: Windows 2003 / FreeBSD
PHP version: 5.2.1
PHP Bug Type: Arrays related
Bug description: Difference in syntax for mysql_fetch_array

Description:
------------
This is dealing with implementation of the return value of
mysql_fetch_array on the following two systems:

1:
FreeBSD 6.1-RELEASE
Apache 2.2.3
PHP 5.2.0
MySQL 5.0.27-standard

2:
Windows Server 2003 SP2 with IIS
PHP 5.2.1
MySQL 5.0.37-community

Basically, there seems to be two different ways of calling the array
returned by mysql_fetch_array which i listed below.
the first one is from my unix box, the second is from my windows box.
Notice that the second one has quotes around 'columnName', which makes


Reproduce code:
---------------
$line = mysql_fetch_array($result, MYSQL_ASSOC);
echo $line[columnName];

/**** OR ****/

$line = mysql_fetch_array($result, MYSQL_ASSOC);
echo $line['columnName'];

Expected result:
----------------
expected to echo the cell value of columnName that was pulled from the
query.

Actual result:
--------------
When you run the unquoted code on windows, you get this:

PHP Notice: Use of undefined constant id - assumed 'id' in
C:\Inetpub\wwwroot\orders\test.php on line 13

where as the quoted OR unquoted version works on unix.

here's the buggy part to me: if i do this...

echo "$line[columnName]";

where the whole echo is quoted, then it works fine on windows, where
sometimes it doesn't like that on unix (i think especially with $_SESSION
vars.

--
Edit bug report at http://bugs.php.net/?id=41058&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41058&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41058&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41058&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41058&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41058&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41058&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41058&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41058&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41058&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41058&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41058&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41058&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41058&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41058&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41058&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41058&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41058&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41058&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41058&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41058&r=mysqlcfg
  Reply With Quote


  sponsored links


2 17th July 13:10
php-bugs
External User
 
Posts: 1
Default #41058 : Difference in syntax for mysql_fetch_array



ID: 41058
User updated by: mattsoghoian at gmail dot com
Reported By: mattsoghoian at gmail dot com
Status: Open
Bug Type: Arrays related
Operating System: Windows 2003 / FreeBSD
PHP Version: 5.2.1
New Comment:

One other thing... The whole problem is that when unquoted, windows
sees the column name within the [] as a constant variable, where the
unix version does not.


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

[2007-04-11 21:53:13] mattsoghoian at gmail dot com

Description:
------------
This is dealing with implementation of the return value of
mysql_fetch_array on the following two systems:

1:
FreeBSD 6.1-RELEASE
Apache 2.2.3
PHP 5.2.0
MySQL 5.0.27-standard

2:
Windows Server 2003 SP2 with IIS
PHP 5.2.1
MySQL 5.0.37-community

Basically, there seems to be two different ways of calling the array
returned by mysql_fetch_array which i listed below.
the first one is from my unix box, the second is from my windows box.
Notice that the second one has quotes around 'columnName', which makes


Reproduce code:
---------------
$line = mysql_fetch_array($result, MYSQL_ASSOC);
echo $line[columnName];

/**** OR ****/

$line = mysql_fetch_array($result, MYSQL_ASSOC);
echo $line['columnName'];

Expected result:
----------------
expected to echo the cell value of columnName that was pulled from the
query.

Actual result:
--------------
When you run the unquoted code on windows, you get this:

PHP Notice: Use of undefined constant id - assumed 'id' in
C:\Inetpub\wwwroot\orders\test.php on line 13

where as the quoted OR unquoted version works on unix.

here's the buggy part to me: if i do this...

echo "$line[columnName]";

where the whole echo is quoted, then it works fine on windows, where
sometimes it doesn't like that on unix (i think especially with
$_SESSION vars.


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


--
Edit this bug report at http://bugs.php.net/?id=41058&edit=1
  Reply With Quote
3 17th July 13:10
External User
 
Posts: 1
Default #41058 : Difference in syntax for mysql_fetch_array


ID: 41058
Updated by: tony2001@php.net
Reported By: mattsoghoian at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Windows 2003 / FreeBSD
PHP Version: 5.2.1
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. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


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

[2007-04-11 22:05:09] mattsoghoian at gmail dot com

One other thing... The whole problem is that when unquoted, windows
sees the column name within the [] as a constant variable, where the
unix version does not.

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

[2007-04-11 21:53:13] mattsoghoian at gmail dot com

Description:
------------
This is dealing with implementation of the return value of
mysql_fetch_array on the following two systems:

1:
FreeBSD 6.1-RELEASE
Apache 2.2.3
PHP 5.2.0
MySQL 5.0.27-standard

2:
Windows Server 2003 SP2 with IIS
PHP 5.2.1
MySQL 5.0.37-community

Basically, there seems to be two different ways of calling the array
returned by mysql_fetch_array which i listed below.
the first one is from my unix box, the second is from my windows box.
Notice that the second one has quotes around 'columnName', which makes


Reproduce code:
---------------
$line = mysql_fetch_array($result, MYSQL_ASSOC);
echo $line[columnName];

/**** OR ****/

$line = mysql_fetch_array($result, MYSQL_ASSOC);
echo $line['columnName'];

Expected result:
----------------
expected to echo the cell value of columnName that was pulled from the
query.

Actual result:
--------------
When you run the unquoted code on windows, you get this:

PHP Notice: Use of undefined constant id - assumed 'id' in
C:\Inetpub\wwwroot\orders\test.php on line 13

where as the quoted OR unquoted version works on unix.

here's the buggy part to me: if i do this...

echo "$line[columnName]";

where the whole echo is quoted, then it works fine on windows, where
sometimes it doesn't like that on unix (i think especially with
$_SESSION vars.


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


--
Edit this bug report at http://bugs.php.net/?id=41058&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666