On Fri, 5 Sep 2003 16:51:03 +0100, "Lance" <la**********@hotmail.com> wrote:
is there a workaround for rows with null values not being returned? I am
using PHP 4.3.2 and mysql. the mysql_fetch_array just seems to ignore some
of the latest rows with null values.
Post code demonstrating the problem? Can't reproduce it here.
mysql> select * from test1;
+------+
| c |
+------+
| a |
| b |
| NULL |
+------+
3 rows in set (0.00 sec)
<pre>
<?php
$conn = mysql_connect('localhost', 'andyh', 'stp40lnk') or die('connect: ' .
mysql_error());
mysql_select_db('testdb') or die('select db: ' . mysql_error());
$res = mysql_query('select * from test1;')
or die(mysql_error());
while ($row = mysql_fetch_array($res))
var_dump($row);
?>
</pre>
Output:
array(2) {
[0]=>
string(1) "a"
["c"]=>
string(1) "a"
}
array(2) {
[0]=>
string(1) "b"
["c"]=>
string(1) "b"
}
array(2) {
[0]=>
NULL
["c"]=>
NULL
}
--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (
http://www.andyh.co.uk)
Space: disk usage analysis tool (
http://www.andyhsoftware.co.uk/space)