I'm currently having a bit of a problem I can't figure out and I guess I'm missing something.
This is the code that doesn't work (for some reason):
$search = "my search keyword";
$findTopics = $db->prepare('SELECT * FROM topics LEFT JOIN forum ON forum.f_id = topics.f_id WHERE topics.keywords LIKE "%:keyword%"');
$findTopics->bindValue(':keyword', $search);
$findTopics->execute();
var_dump($findTopics->fetchAll(PDO::FETCH_ASSOC));
The result when executing the above code is an empty array array(0) { }.
If you change :keyword to my search keyword and remove $findTopics->bindValue(..) it returns results. Also the query works fine if you execute it directly in mysql via a console.
What am I missing here?