Bug #18139: php-mysql returns nothing for a row with any null values in it
| From: | pchandra at mi-corporation dot com | Date: | Wed, 03 Jul 2002 15:37:51 +0000 |
| Subject: | Bug #18139: php-mysql returns nothing for a row with any null values in it | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-12995@lists.php.net to get a copy of this message | ||
From: pchandra@mi-corporation.com
Operating system: Windows XP, Redhat 7.2
PHP version: 4.2.1
PHP Bug Type: MySQL related
Bug description: php-mysql returns nothing for a row with any null values in it
I'm trying to run a rather complex query against a MySQL database housed on
another machine (MySQL version: 3.23.47-nt). When I run this query from
PHP 4.1.2/Linux, 4.2.0/Windows, or 4.2.1/Windows, like this:
$result = @mysql_query($sql, $databaseConnection);
$foo = mysql_fetch_assoc($result);
print_r($foo);
it returns nothing at all. The query is executed successfully and $result
is valid, but $foo is completely empty. mysql_fetch_row() and
mysql_fetch_array() also return nothing. It should return a single row
with NULL in 3 of the columns and real data in the other columns. When I
run the exact same query from either the MySQL console, the MySQL GUI, or
the Perl DBI interface, that's what I get. Also, if I manually change the
row that will be returned so that it contains no NULL values at all, then
the query works from PHP as well. This indicates to me that somehow PHP's
MySQL interface is not handling NULL values correctly.
I am not using any specially compiled version of either PHP or MySQL; just
the stock Windows installer versions of both.
I don't know if this will be of any help, but here is the query:
"SELECT hardware.id_hardware AS HardwareID, session.id_session AS
SessionID,
mod.id_mod AS ModID, glyph.id_glyph AS GlyphID, glyph.glyph AS Glyph,
engine.name AS Engine, guess.guess AS Guess,
guess.confidence AS Confidence, guess.rank AS Rank, glyph.seg_error AS
SegError,
glyph.is_cursive AS Cursive, glyph.european AS European,
guess.id_constraints AS Constraints
FROM glyph NATURAL LEFT JOIN glyph_mod NATURAL LEFT JOIN guess
NATURAL LEFT JOIN engine, mod, hardware, session
WHERE (glyph_mod.id_mod = mod.id_mod) AND
(glyph.id_session = session.id_session) AND
(session.id_hardware = hardware.id_hardware)
AND (BINARY glyph.glyph IN ('A'))
AND (engine.name IN ('Engine1'))
AND (mod.id_mod IN (1,2))
AND (hardware.id_hardware IN (1,2))
AND (glyph.id_glyph IN (9008))
AND (guess.id_constraints IN (1))
AND (glyph.seg_error = 'false')
AND (glyph.is_cursive = 'false')
AND (glyph.european = 'false')
ORDER BY hardware.id_hardware ASC, session.id_session ASC,
glyph.id_glyph ASC, mod.id_mod ASC, engine.id_engine ASC, guess.rank ASC"
Hope this is enough information, but feel free to e-mail me if you need
more. Thanks in advance for looking into this.
--
Edit bug report at http://bugs.php.net/?id=18139&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18139&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18139&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18139&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18139&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18139&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18139&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18139&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18139&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18139&r=globals