php and mysql…
the query:
$sql = "SELECT keyterm
FROM keyterms
WHERE keyterm_id = $keyterm_id";
$result = mysqli_query($dbcon,$sql); // returns a single result
fetch results:
$keyterm = mysqli_fetch_assoc($result);
$keyterm = $keyterm["keyterm"];
what is the equivalent of the last two lines in a single line?
You need to use
fetch_object()because PHP allows you to chain the->operator directly onto the return value of a function, which you cannot do with the[ ]operator.Or, procedural style: