Fix for db_query results not as expected

  1. Sometimes it isn't good to work on code when you're half asleep... of course db_fetch_array only returns a single value because it only gets the next row.... back to sleep now.
  2.  
  3.  
  4. Why does this code
  5.  
  6. <?php
  7.     $query = "SELECT nid from {node} WHERE nid > 0";
  8.     $tmp_result = db_query($query);
  9.     $result = db_fetch_array($tmp_result);
  10.     dpm($result);
  11. ?>
  12.  
  13. Produce this result:
  14.  
  15. (
  16.     [nid] => 1
  17. )
  18.  
  19.  
  20. When this query:
  21.  
  22. SELECT nid from node WHERE nid > 0
  23.  
  24. Produces
  25.  
  26. nid
  27. 1
  28. 2
  29. 3