• 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

Don't show recurring price for WooCommerce subscriptions worth 0$

Login if user is active using Laravel Breeze

How to Make Laravel Eloquent "IN" Query?

Laravel - How to properly generate unique slugs from article titles?

Confirm Leave on External Links in Wordpress

How to set dynamic `home` and `siteurl` in WordPress?

How do I upload a laravel project on cPanel shared hosting?

str_replace or preg_replace random number from string

Maatwebsite Excel 3.1 : how do I skip duplicate data when imported?

How do I loop through an MS SQL database with VB.NET?

dompdf and img tag, image wont show

Xdebug can't connect back to Docker host

Hide specific products from unlogged users based in product category in WooCommerce

advanced custom fields wordpress custom class

WooCommerce - unset "<product> removed notice…" on cart page

About Contact Privacy policy Terms and conditions