I am doing a function that when it receives a number, in the case, an id it makes a query and it rescues the name that is in that id and I come across this error.
code
function catporid($cat){
global $aCon;
$sql = 'SELECT cat_nome FROM cat WHERE cat_id = $cat';
$query = $aCon->query($sql);
$r = $query->fetch_array();
$cat = $r['cat_nome'];
return $cat."id";
}