Hello Experts,
I am new to database design. I have a general idea of what I need to create but inserting, updating, and recalling the data from relational databases is beyond my expertise...
My site has 5 different HTML forms, depending on which link the user clicks on. Each HTML form has a different number of inputs, and collects different data that will be inserted into the corresponding MySQL table. I need to relate my users MySQL table to each of the five form MySQL tables, as each user can enter data into each form an infinite number of times.
So far, I have the following (the users MySQL table and 1 of the 5 form MySQL tables):
TABLE "users" contains an ID auto_increment PRIMARY KEY NOT NULL; and
TABLE "juvenile_civil_citation" contains a juvenile_civil_citationID auto_increment PRIMARY KEY NOT NULL.
The "juvenile_civil_citation" table contains an index of "usersID", which is the primary key from the users table.
I know how to relate the tables to one another (or so I think I do...) using the designer mode in phpMyAdmin but I don't know how to insert the data into the related tables based off the user who is logged in.
Ultimately, my end goal is to have the user login to the site (the login system has already been created), access a form, store the form data into the correct corresponding MySQL table, display the stored data from the corresponding form tables based off the user that is logged in, repopulate the HTML forms with the stored database data when the user clicks an "edit" button, and update the data in the database when the user clicks an update button.
Are there any recommended videos to teach me how to accomplish this?? Or can someone give me a working simple example of a database you created of similar nature with two tables related to one another and the SQL statement you used to insert the data, update the data, and populate an HTML form with. I learn best by sight/visual
A video is possibly a bit touch to much...
See Insert in mySQL
https://www.w3schools.com/mysql/mysql_insert.asp
while the values can also be a SQL statement.
You have only make sure, that the number of fields and the number of values are equal.
See Update in mySQL
https://www.w3schools.com/mysql/mysql_update.asp
Recall I can not really sort in..., do you mean this one?
Possibly not connected to mySQLAdmin.
https://dev.mysql.com/doc/refman/5.7/en/mysql-tips.html
If the user logs in, you have to fetch the ID for that user to have a foreign key for all the other tables.