I'm working on creating a forum (just to test) and i've reached the point where i sync the thread lists and the posts inside. I've relied on the AUTO INCREMENT
in mysql to sync them but i understand that it won't be useful in the future.
My question is now, how would i generate a random number stacking just like the mysql auto_increment
?
For viewing the thread list, it's currently
$sql = "SELECT * FROM threads WHERE th_unique='$section';
$result = mysqli_query($db,$sql);
and then i just fetch the data and output the threads in the list.
Basicly, how would i generate a number just like Auto increment when a insert query is sent?
I am aware of rand()
but i don't find it effective in the end due to the fact that it might overlap and use the same number that already exists.