F
F
freeman02042016-10-23 14:59:33
PHP
freeman0204, 2016-10-23 14:59:33

What are the options for adding records to the database (mysql)?

Example 1:
I need to check if the login and password are correct during authorization, and at the same time I need to access the database to see if the existing login and password match the input.
The fact is that there is no registration on the site yet, this is a prototype of the admin panel.
Where do I need to enter login and password data (like a registered user) so that if I enter it correctly, I can redirect to another page?
Option 2:
If I fill out a form and it is written to the database, then which fields will it be written to?
What are the options for adding records to the database (mysql)? So far I can't figure it out. As for me, it's two. The first is when we manually fill in the tables ourselves (but it’s not clear in what cases to do this?) And the second option is when the information itself gets into the database tables if the user fills in the form fields.
I watched a lot of lessons, but there is no general picture of the work scheme.
Who can briefly explain the scheme of getting (returning from the database) data into the database and what are the ways (filling out the form, or filling in the fields manually in the database)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Aleksin, 2016-10-23
@freeman0204

On the first point - you process the data for registration from the form with a handler, the handler can be in the body of the same document, or another document, send a POST request on the page with the form and accept it on another page. In order to verify the authenticity of the password, you connect to the database, make a request via SELECT with the WHERE login=$login AND pass = $pass condition. This is if we consider the simplest option. Closer to real conditions - store the password as a hash + salt.
On the second - you ask in which fields the data from the form will be written - the data will be written in the fields that you specify. Since you ask such questions, you should learn how to work with the database, try to look at the tutorial on creating a site on phpstart dot com, everything is explained in detail there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question