• 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

Confirm Leave on External Links in Wordpress

GRPC installed successfully on ubuntu but php is looking for it in another folder

Laravel relationship belongsToMany with composite primary keys

Coinpayments create_transaction "ERROR: Invalid command!"

How to fix " Uncaught TypeError: Argument 1 passed to JpGraphException::defaultHandler() " problem in php 7.1.3 and jpgraph 4.2.6?

In PHP, which is faster: preg_split or explode?

Apply filter array/return terms

How to use a PHP MVC Controller, one thats invoked by calling a URL, to call and execute more than one function? [duplicate]

how to retrieve the first and last instance of a row in pdo dataset

Show only featured products in Woocommerce shop page

Extract house numbers from address string

get folder directory from input type file - PHP

Limit login attempts in Laravel 5.7

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

CONCAT columns with Laravel 5 eloquent

About Contact Privacy policy Terms and conditions