mysqli_stmt_bind_param(): Number of variables doesn't match number of parameters in prepared statement in
function get_search_articles($search)
{
global $connect;
$stmt = mysqli_prepare($connect, "SELECT post_id, post_title, post_description, post_keywords, post_author, post_date, post_image, post_content, post_link FROM post WHERE post_title LIKE '%?%'");
var_dump($stmt);
if(!$stmt)
{
echo 'Ошибка выбора из таблицы!';
exit();
}
mysqli_stmt_bind_param($stmt, "s", $search);
mysqli_stmt_execute($stmt);
if(!$stmt)
{
echo 'Ошибка запроса!';
exit();
}
$q = mysqli_stmt_num_rows($stmt);
while($search_articles = mysqli_stmt_fetch($stmt))
{
$search_articles['num'] = $q;
$search_articles['manth'] = mb_substr($search_articles['post_date'], 5, 2);
$search_articles['manth'] = manth($search_articles['manth']);
$search_articles['years'] = mb_substr($search_articles['post_date'], 0, 4);
$search_articles['day'] = ltrim(mb_substr($search_articles['post_date'], 8, 2), '0');
$res_search_articles[] = $search_articles;
}
mysqli_stmt_close($stmt);
return $res_search_articles;
}