samedi 14 mai 2016

MySQL move random row from one table to another

Is it possible to move a random row(with one column) to another table in that way so no one get this data even if will request it simultaneously?

For example: If you open my page, you get a data from MySQL that no one will get even if open this page simultaneously with you.

Now I do it this way:

mysql_query("INSERT INTO `ShowRow` SELECT * FROM `AllRows` WHERE 1 LIMIT 1");
mysql_query("DELETE FROM `AllRows` LIMIT 1");

Is it possible to do some another better way? Or how to SELECTsome specific row if there is only one column?




Aucun commentaire:

Enregistrer un commentaire