I have a problem. I have a List of thousand names and must split them with php, perhaps with mysql. The Names looks like this:
johndoe
peterhoward
martinsmith
mickymaus
aaaa
I have an list of all possible and valid first names and lastnames. Now I want to check first in my list of firstnames (mysql table first_names) if the first name. Then I want to remove the firstname of the string and want to check if the last name is valie (mysql table last_name). But at the moment I have no idea to do that.
1. PHP Method:
Check out the strpos() library function in PHP. This is the most commonly-used and straightforward method in PHP to see if one string is contained in another string. So pull your data set of first names from SQL and compare them in PHP.
if ( strpos($FullName, $FirstName) !== false ) ...
2. SQL Method:
The LIKE operator in SQL will compare 2 values to see if one is contained in the other.
SELECT * FROM table WHERE FullName LIKE FirstName + '%';