How can fetch mutiple row data and insert each of them automatically to another table php mysql [closed]

I am trying to make a function where:

  • in the session if the date of the session is equal to the current data, the function will get all the data that the session is today, and then
  • each of those data items will be inserted to another table which is the notification table
  • then it will input the session id and the username to that table automatically