Answer the question
In order to leave comments, you need to log in
How to increase id by random value in sql table when adding?
How, when inserting data into a table, to simulate a faster growth of id, that is, increasing it by a certain amount, for some reason this code does the insertion as usual, without increasing the id by an amount from 1 to 15
$dddt = rand(1,15);
$insert_sql1 = "INSERT INTO `r_user` (`id`, `date_reg`, `online_seg`, `ip`, `ref_id`, `login`, `pass`, `hash`, `balance`, `social`)
VALUES ('{id + $dddt}', '{$data}', '{$datas}', '{$ip}', '{$refid}', '{$login}', '{$pass}', '{$hash}', '{$bonus_reg}', '');";
mysql_query($insert_sql1);
Answer the question
In order to leave comments, you need to log in
A rather strange task, but nevertheless it is possible like this (An example for understanding the principle)
for ($i=0; $i<3; $i++) {
$dddt = rand(1,15);
$insert_sql = "INSERT INTO events
SELECT MAX(id) + {$dddt}, NOW(), 10 FROM events;";
mysqli_query($mysqli, $insert_sql);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question