Skip to content

Instantly share code, notes, and snippets.

@cygeorgel
Created June 30, 2018 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cygeorgel/3b76e22aa00691d50878c7ca5709c853 to your computer and use it in GitHub Desktop.
Save cygeorgel/3b76e22aa00691d50878c7ca5709c853 to your computer and use it in GitHub Desktop.
Test
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