var sidebar_align = 'right';
var content_container_margin = parseInt('350px');
var sidebar_width = parseInt('330px');
pick a number
I have a php file, which have inside:
I also have another php file, where I would like it to randomly pick an id number from the previous file, can somebody please help me with this?
<? id = 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ; ?>
Thanks in advance!
I don't think this is a valid php code...
<? id = 1,2,3,4,5,6,7,8; ?>
BTW you can try this:
$id=array(1, 2, 3, 4, 5);
Rails in DA
- Ruby on Rails plugin for Directdmin |
- Tomcat Manager plugin for Directdmin
- PostgreSQL plugin for Directdmin |
IP Deny Manager
- IP Deny Manager plugin for Directdmin
- Manager your DirectAdmin server "deeper"
Order now at
If you intend to use mySQL with PHP, you can simply call your IDs by distinction:
SELECT DISTINCT field_id FROM your_table ORDER BY RAND ()
Hi Horizon and Chris,
Originally Posted by
I am not planning to use mysql with us, i just want to store the array in a seperate file, is that possible? or do I need to put the: $id=array(1, 2, 3, 4, 5); in the same file I'm executing it from?
Thanks for your kind replies...
That doesn't seem correct....
$sql = "insert into userid set
UID= 'array_rand( $id )',
save your array to a php file. Lets call it id.php. then do
$randomNumber is a random number from your array.
include 'id.php' ; $arraySize = sizeof ( $id ); $element = rand ( 0 , $arraySize ); $randomNumber = $id [ $element ];
works great! Thanks for all the help!