Created
June 30, 2018 07:19
-
-
Save cygeorgel/3b76e22aa00691d50878c7ca5709c853 to your computer and use it in GitHub Desktop.
Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test($q) | |
{ | |
global $pdo; | |
$sth = $pdo->prepare("SELECT * FROM faq WHERE title LIKE ? OR message LIKE ?"); | |
$data = explode(' ', $q); | |
foreach($data as $element) { | |
if(strlen($element) > 3) { | |
$sth->execute([ | |
'%' . $element . '%', | |
'%' . $element . '%', | |
]); | |
if ($sth->fetchObject() != null) { | |
print $sth->fetchObject()->titre_faq; | |
} | |
} | |
} | |
return; | |
} | |
$test = test('Add a video .'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment