Make the primary key an automatic incremental integer, as most databases support out of the box. Display it as a string for your URLs, translating it to base 36 (which uses the numbers 0-9 and AZ).
echo base_convert($id, 10, 36);
And convert the URLs to database identifiers by converting from base 36 to base 10:
$id = base_convert($url_key, 36, 10);
source
share