DrupalBin
Submit Code
About
Recent Posts
Fix for double entries
5 min 2 sec
ago
Code
13 min 42 sec
ago
double entries
25 min 3 sec
ago
delete double user entries
25 min 44 sec
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for db_query results not as expected
View
Download
Fix
February 14, 2008 - 12:15pm — Anonymous
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.
Why does this code
<?php
$query
=
"SELECT nid from {node} WHERE nid > 0"
;
$tmp_result
=
db_query
(
$query
)
;
$result
=
db_fetch_array
(
$tmp_result
)
;
dpm
(
$result
)
;
?>
Produce this result:
Array
(
[
nid
]
=>
1
)
When this query:
SELECT nid from node WHERE nid >
0
Produces
nid
1
2
3
db_query