$query = "SELECT * FROM categories WHERE MATCH(categories) AGAINST (:search) OR MATCH(content) AGAINST (:search)";
$result = $pdo->prepare($query);
$result->execute(array(':search' => $search));
while ($row = $result->fetch(PDO::FETCH_OBJ))
{
echo "$row->categories";
}
The 'categories' and 'content' fields are both FULLTEXT.
If I run a query and replacing :search with 'freight', it should bring up at least one row, but it brings up nothing. No errors. Just nothing?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Is there some means of checking that it is in fact set??
Some script I can pop into phpmyadmin that gives me the breakdown of the table fields settings? ??
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Ok this does work, if the word "freight" appears in both 'categories' as well as 'content'.
In PHPmyadmin, it then highlights both those fields in the results.
I thought it was becaused I needed to bracketed out the query, so OR is ) OR (.... but nope, that doesn't work.
Take it out of either, and it doesn't show results.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
$query = "SELECT * FROM pages WHERE MATCH(title) AGAINST (:search) OR MATCH(catname) AGAINST (:search)";
$result = $pdo->prepare($query);
$result->execute(array(':search' => $search));
while ($row = $result->fetch(PDO::FETCH_OBJ))
If there is ONE entry that has "test" in the title, then it works. Doesn't work for catname, but does work for "test" in the title.
However, if I then update one of the other titles to have 'test' in it, no results come up.
Why might that be?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.