• 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

Converting alphabet letter to alphabet position in PHP [duplicate]

Add customer email and phone in "Order" column to admin orders list on Woocommerce

xdebug 3 not working in ubuntu 20.04 with docker

enroll_table three field fetch to payment form to create payment field in laravel 5.5

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

Doctrine ORM: Excluding Records Based on Values of Nested Relationships

Laravel: Create morphs() relationship nullable

Applying programmatically a coupon to an Order in WooCommerce3

Calculating Median of an array in PHP

how to insert data into select2 search input after scan using qrcode

Alert message after submitting form in PHP

Require a class from another class - php

PHPS source file - 403 Forbidden You don't have permission to access this resource

Magento 2 - How to add new block to admin panel in product page?

php curl_exec() Connection refused when retrieving a remote image

About Contact Privacy policy Terms and conditions