Home » PHP MySQL LIKE operator string Function

PHP MySQL LIKE operator string Function

PHP MySQL LIKE operator string Function

Today, We want to share with you PHP MySQL LIKE operator string Function.
In this post we will show you Using MySQL LIKE Operator to Select Data, hear for How to use PHP string in mySQL LIKE query? we will give you demo and example for implement.
In this post, we will learn about MySQL not like operator string function with an example.

This MY Very Useful POST covers all the detailed information about how to use LIKE and comparison operator with SELECT statement in MySQL and Example.

List of MySQL LIKE operator examples

MySQL LIKE with percentage (%) wildcard

SELECT 
    username, age, mobileno
FROM
    users
WHERE
    username LIKE 'j%';

SELECT 
    username, age, mobileno
FROM
    users
WHERE
    username LIKE '%on';

SELECT 
    usernumber, username, usercast
FROM
    usermst
WHERE
    username LIKE '%on%';

MySQL LIKE with underscore( _ ) wildcard

SELECT 
    studnumber, studname, studage
FROM
    students
WHERE
    studname LIKE 'T_m';

MySQL LIKE operator with NOT operator

SELECT 
    postnumber, postName, postdesc
FROM
    blogers
WHERE
    postName NOT LIKE 'B%';

MySQL LIKE with where and ESCAPE clause

SELECT 
    postCode, postName
FROM
    blogger
WHERE
    postCode LIKE '%\_20%';

SELECT 
     postCode, postName
FROM
    blogger
WHERE
    postCode LIKE '%$_20%' ESCAPE '$';

Mysql Like multiple values

WHERE schools LIKE '%username%' OR schools LIKE '%std%'

Multiple LIKE values

WHERE schools REGEXP 'username|std'
SELECT * FROM tablename WHERE schools REGEXP 'username|std'
SELECT * from yourtablename where fieldname REGEXP '9898|2250|7689'; 

multi-argument MySQL Search Query

SELECT * FROM fiberbox WHERE field REGEXP '^1740 |1938 $|1940 (.*) test';

Multiple Argument Search in mysql Explain

^ in front of the search value indicates startipakainfo of the line.
$ after the search value indicates endipakainfo of line.
(.*) behaves much like operators the % wildcard.
The . indicates see any like as a sipakainfole character search, except line end breaks. Placipakainfo . inside character () with * (.*) adds a character repeatipakainfo pattern indicatipakainfo any type number of characters till endipakainfo of the line.

Read Also:  check if folder exists before create directory Laravel

SQL search multiple values in same field

we can used to SQL simple IN operator to insted of Like operator to search multiple absolute values:

SELECT username FROM students WHERE username IN ( 'class', 'std', ... );

Like with the results of a subquery

SELECT u1.field1, u1.field2, u1.field3 
FROM
    usermst u1
    JOIN
    (SELECT distinct field AS fieldx from lapakainfomst) l2 
    ON u1.field3 like CONCAT('%',fieldx,'%')

Like ALL in mysql with Example

SELECT * FROM pakainfo WHERE apakainfoular NOT LIKE ALL(ARRAY[my values]);

Development

Read Also:  Laravel 5.6 Sending Emails using SMTP Tutorial

We hope you get an idea about MySQL LIKE Operator
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Read Also:  PHP Codeigniter Image File Upload

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  AngularJS Live Search Box using PHP MySqli
  2. Read Also:  Http Post and Get Web Api Calls using Angularjs
  3. Read Also:  Laravel Vue JS CRUD Example Tutorial From Scratch
  4. Read Also:  how to fetch images from database in php
  5. Read Also:  Create Custom 404 Error page in laravel Example
  6. Read Also:  WooCommerce Get Product Images
  7. Read Also:  How to set (Create), Access and Delete Cookies in codeigniter ?
  8. Read Also:  Laravel 5.6 Sending Emails using SMTP Tutorial
  9. Read Also:  check if folder exists before create directory Laravel
  10. Read Also:  AngularJS Live Search Box using PHP MySqli

Leave a Comment

Your email address will not be published. Required fields are marked *