Join for FREE | Take the Tour Lost Password?
Shop deviantART for the
holidays and save BIG!
Click here! :holly:
[x]

deviantART

 
About Me Member Web Designer behrooz19/Male/Iran Recent Activity Deviant for 3 Years
Needs Premium Membership
Statistics 21 Deviations
520 Comments
1,524 Pageviews

random unique number generator

Tue Nov 24, 2009, 8:16 AM
FINALLY
i wrote a function to generate a random unique number in a mysql table
looks simple
but my brain was about to crash,
wondering if i have

function unique_row_serial($table){
$is_made='no';
$min=10000000;
$max=99999999;
while( $is_made=='no' ){
$number=mt_rand($min,$max);
$query=mysql_query("SELECT * FROM `".$table."` WHERE `serial`='".$number."'");
if(mysql_num_rows($query)<1){$is_made='yosh';}
}
return $number;
}

:D

  • Listening to: i dont know the name, but its nice :P
  • Drinking: tea

deviantID

^____^

Devious Info

    deviantART Community Board

    [x]

    Friends

    :iconkeysbox: :iconredblackdot: :iconrascy007:

    Comments


    :iconwordsoffarewell:
    Thanks for the :+fav: :)

    --
    My Band - [Download Our Songs]: [link]
    :sing: :stereo: :headbang: :aww: :meditation: :tunes:
    :iconbayoo-chan:
    thanks for the fav! :hug:
    :icongevio:
    Hi there!! just to let you know that you favorited a piece of art which is stolen..:(

    stolen piece: [link]

    original: [link]
    :iconnrgpro:
    damn thieves
    ill remove it

    thank u anyway :)
    :iconkemulin:
    thank you for many :+fav: ;)
    :iconferanika1990:
    thank's to add my image..
    :iconrainbowflash:
    thanks for the fave :D

    --
    nothing worse than being ordinary.

    Site Map