views:

61

answers:

0

When I call mysql_fetch_row() or mysql_fetch_array(), any column that is NULL is not in the returned array.

Is this a feature?

Context: I am using CakePHP to get data using Model::find().

EDIT The issue is that when I use the SQL statement:

SELECT col_1, col_2 FROM table where col_1 is defined as VARCHAR NOT NULL and col_2 as VARCHAR NULL

PHP's mysql_fetch_row() returns an array like the following when col_2 is NULL in the DB:

[0] => 'something'

while I would expect:

[0] => 'something', [1] => NULL

so the key [1] is completely missing in the result array.