php - How to create summary of data with the ID the data would insert with -


i've mysql function generate identifier-id given table. table have composite key;

id - auto_increment act_id - bigint(16). id obtained function below. 

this function returns bigint(16)

begin   declare qid integer;  select max(id)+1 qid wi_activity;  if(qid null)     set qid=1; end if; return convert(concat(6,date_format(curdate(),'%d%m%y'),lpad(qid,7,'0')), unsigned integer); end 

problem 1:

the website has multiple data-entry user enter data in given table. there might case when multiple user tries enter data simultaneously. read same value of id generate same value of act_id.

problem 2:

before inserting table, required display data entered including act_id key acquire after insert , must prevent duplicate act_id key generation.

how can these problem solved?

you cannot reliably predict id value record going have, except inserting database.

the best way insert empty (or full, sort of status attached) rows database, , display ids in page. later can update rows "accepted".

any other approach in trouble because only inserted row has reliable id value.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -