1
How is it possible to make a SELECT in MYSQL with PDO next to this below:
$buscarNoticiaTitulo = "noticias.titulo LIKE '%teste%'";
$sqlNoticias = $pdo->prepare('SELECT * FROM noticias WHERE :buscarNoticiaTitulo');
$sqlNoticias->execute(array("buscarNoticiaTitulo" => $buscarNoticiaTitulo));
$resultadoSqlNoticias = $sqlNoticias->fetchAll();
The above example does not give any error, but also does not return anything. If I do without PDO it returns the news with the title "Test 123 testing"
The problem is that the $buscarNoticiaTitulo variable receives several values from an array, so I was mounting it like this:
$buscarNoticiaTitulo = "noticias.titulo LIKE '%teste%' OR noticias.titulo LIKE '%orelha%'"
It can receive infinite words, according to the user’s search... @rray– caiocafardo
@caiocafardo needs to change all logic, to generate the placeholder and mount the
OR
s, pera ai– rray
@caiocafardo maybe this question will help: Search System - Select within another
– rray
Is there an error in the answer? can I correct.
– rray