views:

62

answers:

2

I have a simple function that calls a select query and populates an array with the results:

$result = mysql_query($query);

for ($n=0; $n < mysql_num_rows($result); $n++)
{
    $row = mysql_fetch_assoc($result);
    $output[$n] = $row;
}

return $output;

My table has about 60+ fields and mysql_fetch_assoc returns all of them. However when assigning a row of data to the $output array, I lose more than half of the fields.

A: 

I would avoid array_push and $n++ its usless overhead unless you need to keep trak of the key for soem reason which it doesnt seem like you do... ID use the tradidional:

$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)) {
$output[] = $row;
}

return $output;
prodigitalson
array_push is useless overhead? `$output[] = $row;` is alternative syntax for an array push.
BipedalShark
A: 

Here is the answer to my own question :-\

This code works just fine and all fields are delivered. No problem with PHP or Mysql.

Apparently, netbeans has some limitation on displaying all fields when viewing an array variable. However, when specifically using a watch variable, it will display the value.

Don't know how to increase the number of fields in the netbeans IDE during debug.

mitch