note 59680 added to function.mysql-errno

From: Date: Tue, 13 Dec 2005 11:40:00 +0000
Subject: note 59680 added to function.mysql-errno
Groups: php.notes 
Request: Send a blank email to php-notes+get-100051@lists.php.net to get a copy of this message
Function for creating unique md5 keys in a database. If there are duplets, then a new md5-key will be generated. For your use: function users_md5create($id){ global $mysql_link; while ($done==0) { $md5key = md5(time().($id/2).$loop).md5(time().$id.$loop); $query = "INSERT INTO users_md5create SET md5key='$md5key', fkey='$id', created=UNIX_TIMESTAMP() "; $mysql_result = mysql_query($query, $mysql_link); if(mysql_errno($mysql_link)!=1062) $done=1; $loop++; } return($md5key); } ---- Manual Page -- http://www.php.net/manual/en/function.mysql-errno.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59680 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59680&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59680&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59680&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59680&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59680&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59680&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59680&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59680&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#100051) next »