DrupalBin
Submit Code
About
Recent Posts
Code
1 hour 47 min
ago
Fix for my user handler
2 hours 9 min
ago
Fix for my user handler
2 hours 13 min
ago
my user handler
4 hours 1 min
ago
more
Tags
CCK
fapi
javascript
jquery
menu
module
Panels
simpletest
template.php
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
Random non-colliding computed field values
View
Download
Fix
February 18, 2008 - 12:30am — Anonymous
$rand
=
mt_rand
(
0
,
1000000000
)
;
while
(
(
int
)
db_result
(
db_query
(
'SELECT COUNT(*) FROM content_type_<content_type_name> WHERE field_<fieldname> = %d'
,
$rand
)
)
>
0
)
{
$rand
=
mt_rand
(
0
,
1000000000
)
;
}
$node_field
[
0
]
[
'value'
]
=
$rand
;
CCK
computed field