Hello!
Tell me, please, how can I get the value of folder2 in the table and then immediately increment this value by +1. It is important that when a large number of simultaneous requests are received, the values of folder2 do not repeat.
+----+---------+--------+ | id | folder1 | folder2| +----+---------+--------+ | 1 | 235 | 13 | +----+---------+--------+ I would do a php request like this:
$sql_query1 = "SELECT folder2 from tbl_name"; $sql_query2 = "UPDATE tbl_name SET folder2 = folder2 + 1" But what if it takes some time between $ sql_query1 and sql_query2, and other users will also run the script. Then some number of users will have a coincidence of folder2 values.
How can this be avoided?
Thank!
folderswith your incremental primary key - Anton Shchyrov 4:52