Raw php search function is not working with sql squery in php 7.4

Question

I have created a table name is school and i stored some data.

+----------------+------------------------------------+---------------+
| ID             | Name                               | Description   |
+----------------+------------------------------------+---------------+
| 1              | Google School  USA                 | 'Description' |
| 2              | Bing School  California            | 'Description' |
| 3              | Yahoo School  Australia            | 'Description' |
| 4              | MSN School  Dhaka                  | 'Description' |

So what i want, when user search like “google usa” it will be show first one. How can i write code by sql query in php

I have this code which is not working at this time.

if(isset($_POST['searchbtn']) ){
   $searchContent = strtolower(mysqli_real_escape_string($db, trim($_POST['search'])));
    $sql = "SELECT * FROM schoolist WHERE name  LIKE '%$searchContent%')";
}

0
Happy Arif 2 months 2022-07-01T07:53:55-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse