Answer the question
In order to leave comments, you need to log in
How to make a fetch in prepared PDO queries?
I use PDO
$base = new PDO($dsn, $db_user, $db_pass, $opt);
$base -> query("SET NAMES 'UTF8'");
function acc($sql, $params = array()) {
global $base;
$stmt = $base -> prepare($sql);
$stmt -> execute($params);
$stmt = $stmt->FetchAll(PDO::FETCH_ASSOC);
return $stmt;
}
$result= acc("SELECT * FROM `name` WHERE `article` LIKE '%$article%' AND `article2` LIKE '%$article2%'"); // надо выполнить запрос такого типа, но этот вариант опасный
$result= acc("SELECT * FROM `name` WHERE `article` LIKE ? AND `article2` LIKE ?", array('%$article%','%$article2%')); //пробовал так, но - облом
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question