I am doing a news system and I want my url in the following way:
http://web.com/noticias/{id_generado}/
The {id_generado}
is an id that I generate using the str_random(10)
function.
The problem of the matter is: What happens if two news by chance generate the same {id_generado}
?
How can I check beforehand if that id has already been assigned to another news item and generate a new one? With a do-while?