D
D
dev4002016-03-01 21:15:56
PHP
dev400, 2016-03-01 21:15:56

Is it appropriate to use time concatenation ( mktime() ) and auto increment to get a unique id?

if I write elements with id obtained in this way to the database, will there be any pitfalls in the future?

<?php $id=0; ?>
<?foreach($data as $k=>$v):?>
<div id="<?=$id++ . mktime()?>">
Текст который нужно записать в базу, у него есть уникальный id
</div>
<a id="<?=$id . mktime()?>" href="<?=$v?>"><?=$k?></a>
<?endforeach?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
He11ion, 2016-03-01
@dev400

Normal, but it's really better to use autoincrement

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question