• 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

Laravel Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) on a sub query with "ROW_NUMBER() OVER PARTITION"

Mobile browsers are adding .html to filename on download

How to find the date a user created their Google account

PHP: remove filename from path

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

Sentry + Laravel: how to log an already catched Exception?

Warning: sqlite_query() expects parameter 1 to be resource, string given

Laravel-fopen: failed to open stream: Permission denied

How to add a sidebar to Woocommerce Shop Page?

How do I do HTTP basic authentication using Guzzle?

Can we define variables in `.tpl` files?

Dynamic table in HTML using MySQL and php

WordPress - Dynamically add user ID to the end of a URL

The "client_reference_id" argument is not passed

PHP error: "The zip extension and unzip command are both missing, skipping."

About Contact Privacy policy Terms and conditions