This topic is locked

Multi table data display and update

3/6/2021 7:59:49 PM
PHPRunner General questions
B
bipingaur author

Hello,
What I am seeking may be very simple but I have not been able to figure it out last few days (new user of phprunner)

I have three tables
trainings

  • trainings_id : int(11)
  • trainings_name : text
    user
  • user_id : int(11)
  • user_name : text
    usertraining
  • usertraining_id : int(11)
  • usertraining_user_id : int(11)
  • usertraining_training_id int(11)
    The entries in table 'usertraining' are as below
    usertraining_id usertraining_user_id usertraining_training_id

    9 5 4

    11 5 2

    12 5 3

    13 5 1

    15 4 1

    16 4 3

    18 4 5
    Here are my questions

  1. Can a single table be used to create dependent drop downs? i.e. table 'usertraining' filters data on 'usertraining_user_id' and populates the field 'usertraining_training_id'.
  2. On edit page the same filtering to work, the already selected values are checked (they can however be unchecked here) the other non checked values can be checked. If value of 'usertraining_user_id' is changed here, they values of 'usertraining_training_id' to reflect the change.
  3. On submit the values to be updated /input in table 'usertraining'
  4. If there is any user or training deleted from the tables 'trainings' or 'user' the delete should also reflect in table 'usertraining'. If say user 4 is deleted from user table all the values corresponding to that user in table 'usertraining' should also get deleted. or is a training from the table 'trainigs' is deleted, for example training with id 3 is deleted the corresponding value for both user 4 and 5 should be deleted in the table 'usertraining'
  5. How, can two sql queries be used on a single table in different pages, one to populate edit page and one to populate page view page
    Your responses are awaited - thank you