Like this code?
Show the author your appreciation.
This is good only when you need to assign a random no. for and encryption or assign users on your site random no.s for something like registration for a page that lasts for a short period of time. you can get any no. of digits using this script. Simply call randomdigit( no. of digits required) and you dont get any leading zeros
<?php
function randomdigit ( $digits ) {
static $startseed = 0 ;
if (! $startseed ) {
$startseed = (double) microtime ()* getrandmax ();
srand ( $startseed );
}
$range = 8 ;
$start = 1 ;
$i = 1 ;
while ( $i < $digits ) {
$range = $range . 9 ;
$start = $start . 0 ;
$i ++;
}
return ( rand ()% $range + $start );
}
?>
mySQL/PHP/search with multientry
form and table output with colored rows Categories : PHP , Beginner Guides , MySQL , HTML and PHP , Databases Specify your connection settings and create a link to a MySQL database. Categories : PHP , PHP Classes , Databases , MySQL , Beginner Guides Upload Via FTP - an alternative to move_uploaded_file Categories : PHP , FTP , Beginner Guides A beginner's session handling class Categories : PHP , PHP Classes , Sessions , Beginner Guides Newbie Notes #3 - What went wrong? A useful little debugging aid Categories : PHP , Beginner Guides , Debugging Basic Authentication with sessions Categories : PHP , Beginner Guides , Authentication , Form Processing , Sessions Change the background color of a website daily dynamically using the php date function to get the current day of the week and depending on that day, set the background color for the web page. Categories : PHP , Date Time , Beginner Guides , Web Design Form Submission Using Array's Categories : PHP , HTML and PHP , Beginner Guides , Arrays Simple Session example Categories : PHP , Beginner Guides , Sessions Link Submition - Allow your visitors to submit links to the site. Categories : PHP , Arrays , Filesystem , Beginner Guides Script loading time Categories : PHP , Beginner Guides , Date Time Different Call User Functions Categories : PHP , Functions , Beginner Guides Introduction to Language Files Categories : PHP , Filesystem , Beginner Guides Current Page's URL using PHP Categories : PHP , Beginner Guides , Global Variables SQLite PHP Database Wrapper Categories : PHP , PHP Classes , Databases , SQLite , Beginner Guides