I'm creating a new PHP page and I have a variable which consists out of the addition of two fields of my MySQL database. I would like to find which row corresponds to the variable, which consists of a combination of two fields.
I was unable to find any answers online, and when I did, none of them seem to work.
Database example:
ID | Name 1 | Name 2
----+---------+--------
1 | john 1 | doe
2 | jane | doe
3 | john | doe
4 | john | doe 1
My variable which I ought to match to a row is $var = "john doe 1";
, and splitting my variable is not an option.
I expect the output of said SQL statement to be the row with ID = 4
.
EDIT: I do not believe this to be a duplicate. I'm not having any problems with the CONCAT clause itself, I was consulting about which clause to use and how to use it, not how to fix my current one.