I have a form that does a search via PDO, but when I run it, it does not return anything to me.
$PDO = db_connect();
$busca = $_POST['usuario'];
$vbusca = "%".$busca."%";
$sql = 'SELECT nome, tipo, cor FROM livro AS t WHERE ';
var_dump($sql);
$stmt = $PDO->prepare($sql);
$stmt->execute([$vbusca]);
$total = $stmt->rowCount();
I have given var_dump
to variable $stmt
and it is returning the following:
string (57) "SELECT name, type, color FROM book AS t WHERE" object (PDOStatement) # 2 (1) {["queryString"] = > string (57) "SELECT name, type, color FROM book AS t WHERE "}