Ben aşağıdaki işlevleri uygulamak gerekir:
Ben adını ve soyadını hem de içeren bir isim alanı var. Bu bir veritabanında saklanır ve sipariş 'soyadı adı' halindedir.
Ben bu kayıtları arar bir komut uygulama duyuyorum. Şu anda, ben bir boşluk varsa bunu örneğin bir isim değil, bir Kimlik Kartı Numarası anlamına gelir dize, bir boşluk olup olmadığını kontrol başardı. İşte kod:
$query = "John Doe";
$checkIfSpaceExists = strpos($query, " ");
if ($checkIfSpaceExists == "")
{
//No Space therefore it is not a name
}
else
{
//Contains space
$queryExploded = explode(" ", $query);
foreach ($queryExploded as $q)
{
//Here I need the functionality so that if someone entered John Doe
//2 different strings are saved, which are
//$string1 = John Doe
//$string2 = Doe Johns
//If the name consists of 3 parts, strings for every combination is saved
}
Sonra GİBİ özniteliği ile bir SQL deyimi bu dizeleri eklemek ve JOHN DOE ve DOE JOHN hem de GİBİ olacaktır. Bu nedenle, kullanıcı ya da sonucu bulmak için John Doe ya Doe John girebilirsiniz eğer.
Bunun nasıl herhangi bir öneriniz?
Çok teşekkürler
chris