Search more than one column Mysql PHP

Hi all! Hopefully something not too taxing, but has stumped me once again!

I am trying to search for data from two or more columns, but am struggling to add to the SELECT * FROM code and get results.

Code being:
if((isset($_POST[‘submit’])) && (isset($_POST[‘search’]) && ($_POST[‘search’] != NULL))) {
$search = $mysqli->real_escape_string($_POST[‘search’]);
$result = $mysqli->query(“SELECT * FROM careers2 WHERE jobTitle regexp ‘$search’”);

Searching the ‘jobTitle’ is getting results, but I would like to search both ‘jobTitle’ AND ‘jobDescription’ columns to get results.

Anything I have tried seems to stop all searches from happening :roll_eyes:

Any help very much appreciated!

Using an AND would require that the search term exist in both the JobTitle AND in the jobDescription. If you want to find results WHERE the search term exists in either one or both columns, you would need to use OR between the terms.

Sponsor our Newsletter | Privacy Policy | Terms of Service