Well, I have this function in a custom script for SMF:
$query = \"SELECT id_member, real_name, id_group FROM smf_members WHERE id_group > 0 AND id_group != 9
your query
function Display($member_id){
$queryDisplay = "SELECT value FROM smf_themes WHERE id_member = ".$member_id." AND variable = 'cust_realfi'";
}
right query
function Display($member_id){
$queryDisplay = mysql_query("SELECT value FROM smf_themes WHERE id_member = '$member_id' AND variable = 'cust_realfi'");
while ($row = mysql_fetch_array($queryDisplay));
return $row['value'];
}