php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21875 mysql_fetch_array delivers wrong result
Submitted: 2003-01-25 06:05 UTC Modified: 2003-01-25 08:37 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: c dot bock at qbiz dot de Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.0 OS: Windows 2k / SuSE Linux 7.3
Private report: No CVE-ID: None
 [2003-01-25 06:05 UTC] c dot bock at qbiz dot de
I have a small table, having only two columns (id + name). For keeping my PHP code general, i executed the following SQL Statement:
"select name, id, 1 from tablename"
The Result was: 
+----+------+---+
| id | name | 1 |
+----+------+---+
|  1 | 1    | 1 |
|  2 | 1    | 1 |
|  3 | 1    | 1 |
|  4 | 1    | 1 |
+----+------+---+
Later on, i tried the same statement with 0 instead of 1, and the id was all set to 0.
The workaraound, i found was writing "select name, id, 1 as type from tablename", which worked fine for me.
I've checked, if mySQL delivers a correct result and it does. I have not checked, if this is a general database problem.

Thanks in advance and keep up the great work!

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-25 06:11 UTC] derick@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2003-01-25 08:37 UTC] georg@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

When using mysql_fetch_array you have to specify an alias for numbers or you have to specify optional parameter MYSQL_ASSOC/MYSQL_NUM (and not MYSQL_BOTH).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Aug 16 00:01:28 2024 UTC