The code below works fine when its not in wrapped in a function
$opt = 'logo_img';
$sql="SELECT option_value FROM r0_options WHERE option_name='".$opt."'";
$result=mysqli_query($db,$sql);
$row=mysqli_fetch_array($result,MYSQLI_NUM);
var_dump($row);
However when I do as follows, and call the function, it gives NULL.
function get_result($opt){
$sql="SELECT option_value FROM r0_options WHERE option_name='".$opt."'";
$result=mysqli_query($db,$sql);
$row=mysqli_fetch_array($result,MYSQLI_NUM);
var_dump($row);
}
get_result('logo_img');