Okay, I'm quite new to Mysql and I can't find a simple solution to my question. I want to search my database and return all instances of a string. ex: user types "hello world" and database returns queries of "hello my name is world" etc. I'll take these results and push them into a php array.
here's my attempt of it according to this:
include '../config.php';
$con = new PDO('mysql:host='. DB_HOST .';dbname='. DB_NAME .'', DB_USER,DB_PASSWORD);
$firstsearcharray = array(); // push into this array
$searchqueryarray = explode(" ",$searchquery);//$searchquery is data sent from AJAX
$query = $con->prepare("SELECT * FROM srating where MATCH(title) AGAINST (':searchqueryarray')");
$query->bindParam(':$searchqueryarray',$searchqueryarray);
$query->execute();
$data = $query->fetch(PDO::FETCH_ASSOC);//I have to somehow push each result into an array (possibly using array_push and a for loop)
I believe that the way I'm searching isn't optimal. I would prefer to use CONTAINS over LIKE as I've heard that it is faster, but it is way less documented than LIKE.