php - Best practice: Upload a picture for non existing Task -


i programming crm (customer relationship management) employees can add tasks , asign them other employees (in php).

it's required employees should able upload images task (e.g. when having bug, make print screens , add them task)

now question is, how make association between images , task in database? @ point employees enter "create task form" in gui there no "task" entry in database yet, therefore can't assign uploaded pictures "task_id". logic requires "task" entry in db made, before can upload picture. why? => because when have entry table "task" have "task_id" required make entry in "task_image" (for foreign key).

i thought option create task_id via guid instead of using auto increment function, not possible due other requirements.

if it's not possible make task entered task table before store picture's details in pictures table, use arbitrary value taskid , pass through forms using hidden fields, until store task in table, run update query changing taskid correct value instead of arbitrary 1 @ end.

something like:

insert pictures (picid, taskid, ...) values (null, 'arbitrary', ...); //perform remaining operations related task //insert task task table update pictures set taskid = $correcttaskid taskid = 'arbitrary'; 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -