use a Unix time stamp
Unique every "time"PHP Code:
$unixtime = time();
echo $unixtime;
Why dont you use an Auto Incrementing field as Primary Key in the database table?
I am trying to create a simple blog engine using PHP and mysql. I'm having trouble generating unique post ID's that I can associate with a clean URL format. I am currently using this strategy:
The URL format is: example.come/username/2010/11/09/title-title-title
then I'm using mod_rewrite to convert this format to URL parameters and then append the parameters to come up with post ID.
The problem is: if a user posts 2 blogs with the same title on the same day, this strategy fails. Can someone suggest a better strategy?
use a Unix time stamp
Unique every "time"PHP Code:
$unixtime = time();
echo $unixtime;
Why dont you use an Auto Incrementing field as Primary Key in the database table?
Last edited by is_numeric; 10 Nov 2010 at 08:25 AM.