PHP MYSQL: instant select + insert -
PHP MYSQL: instant select + insert -
i need pull mysql value , alter forwards value , insert in mysql.
for illustration :
$str = mysql_fetch_assoc(mysql_query('select `str_id` `ids` order `num_id` desc limit 1 ')); // = aaa $str = $str++; // aaa -> aab // check if "aab" key exist // if not , insert key "aab" as algorithm there risk script runs 2 sides of globe , 2 unique keys sign "aab"..
how can without risk of sign unique key 2 times?
if set database column unique, mysql table not allow add together same value twice. can check result of transaction ensure succeeded.
from illustration looks want incremented unique key. should utilize integer this, can automatically increment when insert new row. if want in string form perform basic math on it. i.e.
1 = 2 = b ... 27 = aa 28 = ab this assuming don't have primary key on table, in case don't understand why need string in form. helps, , apologize if misunderstood question.
php mysql key unique
Comments
Post a Comment