• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Correct way to use LIKE '%{$var}%' with prepared statements?

phpmysqlsqlmysqli


PHP Snippet 1:

$likeVar = "%" . $yourParam . "%";
$stmt = $mysqli->prepare("SELECT * FROM REGISTRY where name LIKE ?");
$stmt->bind_param("s", $likeVar);
$stmt->execute();

Related Snippets

Handling expired token in Laravel

phpMyAdmin Accepts NULL in the NOT NULL field

Match csv filenames to table names and import

PHPExcel file download using AJAX call

Change the alert text on add to cart action without selected variation in Woocommerce

javascript html popup window

Match csv filenames to table names and import

Login if user is active using Laravel Breeze

Inserting Country Selection into MySQL PHP [duplicate]

Losing session data after POST from third party website

Adding the custom page with add_menu_page function on Wordpress

Warning: A non-numeric value encountered

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

SQL AVG() to 2 decimals

google content api for shopping

About Contact Privacy policy Terms and conditions