SOLVED: [PHP] random alphanumeric value generator
| From: | craig | Date: | Mon, 26 Jan 2004 23:17:07 +0000 |
| Subject: | SOLVED: [PHP] random alphanumeric value generator | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175826@lists.php.net to get a copy of this message | ||
I love this list!
That's perfect! I was able to simplify the function down even more.
Thanks a lot,
Craig
> -----Original Message-----
> From: Matt Matijevich [mailto:matijevich@alliancetechnologies.net]
> Sent: January 26, 2004 4:01 PM
> To: php-general@lists.php.net; php@lonsbury.com
> Subject: Re: [PHP] random alphanumeric value generator
>
>
> because it is MySQL, couldn't you just use mysql_insert_id
> http://www.php.net/manual/en/function.mysql-insert-id.php
> instead of
> this:
>
> //now get the random number, and MD5 it to get it alphanumeric
> $query = 'SELECT MAX(uiIndex), cKey FROM randomKey GROUP BY cKey';
> $result = mysql_query($query, dbConnect($errorMsg));
> $row = mysql_fetch_object($result);
>
> use this
>
> return md5(mysql_insert_id());
>
>
>