Working with the LIKE Operator in PDO in PHP
To use the
LIKE operator in a prepared query,
you need to specify
the value for its variable
using a special
syntax:
php<?php
$var = '%value%';
?>
Let's find a user by name,
using the LIKE operator:
php<?php
$name = '%user1%';
$res = $pdo->prepare('SELECT * FROM users WHERE name LIKE ?');
$res->execute([$name]);
$row = $res->fetchAll();
var_dump($row);
?>
Задание 1
Display all users
from the users table,
whose salary is equal to
500.
Задание 2
Display users
whose salary is equal to or more than
900, and whose age
is less than 35 years.