This is not a SQL issue, it's a PHP issue. So let's simplify the problem and make it just a PHP string with a variable in it.
$string = "blah blah ("$term") yadda yadda";
Using PHP variables in string cannot be done this way, because the double quote that you want to use around your variable terminates the double quote at the start of the string.
You can make the double-quotes into literal double-quote characters instead of PHP string delimiters by escaping them:
$string = "blah blah (\"$term\") yadda yadda";
But I find that ugly.
You can also use different single-quotes inside the PHP string without escaping them:
$string = "blah blah ('$term') yadda yadda";
Because single-quotes inside double-quotes are treated as literal characters. In the case of SQL, it's preferable because single-quotes are more standard string delimiters in SQL syntax.
You can combine a variable with a string with string concatenation:
$string = "blah blah (" . $term . ") yadda yadda";
This uses the string concatenation operator .
to combine three strings. The first and third string use double-quotes. The middle one is your variable. But this solution doesn't give you what you want because the resulting string looks like:
blah blah (term) yadda yadda
When what you presumably wanted was:
blah blah ('term') yadda yadda
So you have to put the single quotes inside anyway, so they end up in the result:
$string = "blah blah ('" . $term . "') yadda yadda";
Finally, the string concatenation is not necessary in any modern version of PHP. I always find it puzzling why people continue to use this method, probably because it's in some old books on PHP. You can now do this more simply:
$string = "blah blah ('$term') yadda yadda";
If your variable is something more complex like an array element or something, you might have to enclose it like this:
$string = "blah blah ('{$term[0]}') yadda yadda";
All of the above just addresses the issue of combining PHP variables with PHP strings. You should understand how to do that.
But you should also understand that for SQL queries as strings, it's better to use query parameters. Parameters makes the whole issue of combining variables with queries much simpler. You don't have to worry about quotes or escaping.
$results = $dbh->prepare("
SELECT * FROM images
WHERE
MATCH(imgTitle,imgDescr,copyright,keywords)
AGAINST( ? IN BOOLEAN MODE)
ORDER BY copyright, images.imgName, images.sortOrder ASC");
Replace your variable with a placeholder ?
. Don't put quotes around the placeholder inside your SQL string.
Then pass your variable to the prepared query separately, when you execute:
$results->execute([$term]);
That's PDO usage. I can't tell if you're using PDO or Mysqli from your code. Mysqli is a little bit different:
$results->bind_param('s', $term);
$results->execute();