Задать вопрос

Почему запрос prepare не работает с like?

Выдаёт ошибку Warning: mysqli_stmt_bind_param(): Number of variables doesn't match number of parameters in prepared statement in

$search_articles = 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 '%?%'");

		mysqli_stmt_bind_param($search_articles, 's', $search);


пробовал %?% выдаёт Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in

этот работает как не странно

$post_old = 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_link = ? LIMIT 1");

		mysqli_stmt_bind_param($post_old, "s", $param_name_article);
  • Вопрос задан
  • 225 просмотров
Подписаться 1 Оценить Комментировать
Решение пользователя Олег К ответам на вопрос (2)
Austin_Powers
@Austin_Powers
Web developer (Symfony, Go, Vue.js)
Так пробовал?
$search_articles = 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 ?");

    mysqli_stmt_bind_param($search_articles, 's', "%$search%");
Ответ написан