0
Php problem
New Here
,
/t5/dreamweaver-discussions/php-problem/td-p/549796
Apr 21, 2007
Apr 21, 2007
Copy link to clipboard
Copied
Hi!
I would like to ask about some solution for my problem.
I want to generate a number randomly but the number must not equal the ones in my database.
This is important couse if somebody upload a picture a number is generated, but how do i write the image path for the picture if i don't no what number's been generated?
Thank you in advance.
I would like to ask about some solution for my problem.
I want to generate a number randomly but the number must not equal the ones in my database.
This is important couse if somebody upload a picture a number is generated, but how do i write the image path for the picture if i don't no what number's been generated?
Thank you in advance.
TOPICS
Server side applications
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/php-problem/m-p/549797#M143028
Apr 21, 2007
Apr 21, 2007
Copy link to clipboard
Copied
Jose 123 escreveu:
> Hi!
> I would like to ask about some solution for my problem.
> I want to generate a number randomly but the number must not equal the ones in
> my database.
> This is important couse if somebody upload a picture a number is generated,
> but how do i write the image path for the picture if i don't no what number's
> been generated?
> Thank you in advance.
>
Why not use "microtime"?
http://www.php.net/manual/en/function.microtime.php
http://www.educar.pro.br/a/dttime/index.php?pn=14&tr=17
http://www.educar.pro.br/a/dttime/index.php?pn=11&tr=17
http://www.educar.pro.br/a/math/index.php?pn=39&tr=41
--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
----------------------------------------------------------
Você deve, sempre, consultar uma segunda opinião!
----------------------------------------------------------
Deixe todos saberem se esta informação foi-lhe útil.
----------------------------------------------------------
You must hear, always, one second opinion! In all cases.
----------------------------------------------------------
Let the people know if this info was useful for you!
----------------------------------------------------------
> Hi!
> I would like to ask about some solution for my problem.
> I want to generate a number randomly but the number must not equal the ones in
> my database.
> This is important couse if somebody upload a picture a number is generated,
> but how do i write the image path for the picture if i don't no what number's
> been generated?
> Thank you in advance.
>
Why not use "microtime"?
http://www.php.net/manual/en/function.microtime.php
http://www.educar.pro.br/a/dttime/index.php?pn=14&tr=17
http://www.educar.pro.br/a/dttime/index.php?pn=11&tr=17
http://www.educar.pro.br/a/math/index.php?pn=39&tr=41
--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
----------------------------------------------------------
Você deve, sempre, consultar uma segunda opinião!
----------------------------------------------------------
Deixe todos saberem se esta informação foi-lhe útil.
----------------------------------------------------------
You must hear, always, one second opinion! In all cases.
----------------------------------------------------------
Let the people know if this info was useful for you!
----------------------------------------------------------
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Jose_123
AUTHOR
New Here
,
/t5/dreamweaver-discussions/php-problem/m-p/549798#M143029
Apr 21, 2007
Apr 21, 2007
Copy link to clipboard
Copied
And how should i use this? Sorry I don't speak spanish
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/dreamweaver-discussions/php-problem/m-p/549799#M143030
Apr 21, 2007
Apr 21, 2007
Copy link to clipboard
Copied
Jose 123 escreveu:
> And how should i use this? Sorry I don't speak spanish
hehehe.... this is portuguese, not spanish.
Try to use this code:
?php
$time = microtime();
$strsp = " "; // string delimiter.
list ($dt, $t) = explode( $strsp, $time );
/*
$dt -> variable assigned by the user to represent the fractionary
decimal part of $time
$t -> variable assigned for by user to represent the integer decimal
part of $time
*/
echo " \$t = " . $t . " s<br /><br />";
echo "\$dt = " . $dt . " s<br /><br />";
echo "\$t + \$dt = ";
echo $t + $dt . " s";
/*
For each new execution of this script, a bigger value than the previous
$time is generated.
You can use the integer decimal part ($t) to generate a new unique value
*/
?>
----------------
Ah... you can use too:
http://www.php.net/manual/en/function.uniqid.php
--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
----------------------------------------------------------
Você deve, sempre, consultar uma segunda opinião!
----------------------------------------------------------
Deixe todos saberem se esta informação foi-lhe útil.
----------------------------------------------------------
You must hear, always, one second opinion! In all cases.
----------------------------------------------------------
Let the people know if this info was useful for you!
----------------------------------------------------------
> And how should i use this? Sorry I don't speak spanish
hehehe.... this is portuguese, not spanish.
Try to use this code:
?php
$time = microtime();
$strsp = " "; // string delimiter.
list ($dt, $t) = explode( $strsp, $time );
/*
$dt -> variable assigned by the user to represent the fractionary
decimal part of $time
$t -> variable assigned for by user to represent the integer decimal
part of $time
*/
echo " \$t = " . $t . " s<br /><br />";
echo "\$dt = " . $dt . " s<br /><br />";
echo "\$t + \$dt = ";
echo $t + $dt . " s";
/*
For each new execution of this script, a bigger value than the previous
$time is generated.
You can use the integer decimal part ($t) to generate a new unique value
*/
?>
----------------
Ah... you can use too:
http://www.php.net/manual/en/function.uniqid.php
--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
----------------------------------------------------------
Você deve, sempre, consultar uma segunda opinião!
----------------------------------------------------------
Deixe todos saberem se esta informação foi-lhe útil.
----------------------------------------------------------
You must hear, always, one second opinion! In all cases.
----------------------------------------------------------
Let the people know if this info was useful for you!
----------------------------------------------------------
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

