W
W
Wayz2018-03-27 03:12:46
MySQL
Wayz, 2018-03-27 03:12:46

How to find a record in a database by three criteria?

There are three forms for entering the last name, first name and patronymic of the user. How to get user id from MYSQL database by three parameters?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ilya, 2018-03-27
@Wayz

SELECT * FROM users WHERE name='Имя' AND lastname='Фамилия' AND patronymic='Отчество'

V
Vyacheslav Barsukov, 2018-03-27
@slavabars

The task is not entirely clear.
3 forms with 3 fields and find if entered in one form? Or if the Name is in one and the surname is in the other?
If it's just 3 forms, then what's the problem with listing everything through and and or?
(where name=$name1 and surname=$surname1 and patronymic=$patronymic1) or
(where name=$name2 and surname=$surname2 and patronymic=$patronymic2) or
(where name=$name3 and surname=$surname3 and patronymic= $patronymic3)

T
Talyan, 2018-03-27
@flapflapjack

I understand that, judging by the question, you have no idea how MySQL works?
Do this:
PHPMyAdmin has a "search" button - click it, enter search parameters, click "find" and phpmyadmin will give you the result, and show you what query it found it with. So you can learn at the initial level how the table is accessed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question