Utilizing OpenAI's Premium API for Custom Questioning

Hello to everyone,
I am reaching out a way in order to use OpenAI’s Premium API and ChatGPT for asking users specific questions defined by me and stores the users’ responses in a specific database (for example mysql).

Is there any documentation or guidelines available that explain the process for achieving this? I would like to know if there are any guidelines or example code snippets I can follow to accomplish this.

Thank you in advance for your assistance