Created
July 21, 2011 18:24
-
-
Save JanVoracek/1097816 to your computer and use it in GitHub Desktop.
Návrh zajištění unikátnosti rezervací pomocí unique indexu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cetnost_tematu = 3; // vytáhne z db | |
$i = 0; | |
do { | |
mysql_query("INSERT INTO rezervace (id_tema,cetnost) VALUES ($tema,$i)"); | |
$i++; | |
}while($i < $cetnost_tematu && mysql_errno() == 1062); // dokud nedosahnu maximalni cetnosti a insert selhal na unikatnosti zaznamu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PRIMARY | UNIQUE | ... | |
id | id_tema | cetnost | id_skupina | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment