I need some help with a function. Is the function incorrectly written? Or is there a problem using a function to access a table to extract a field from a specific table?
function getSiteName($string)
{
$sql3="SELECT fieldName
FROM sites_info
WHERE siteID = '".$string."'
LIMIT 1";
$res3 = mysql_query($sql3, $link )or die(mysql_error($mysql));
$getsite = mysql_result ( $res3 , 0 , "fieldName");
$site = $getsite;
return $site;
}
print getSiteName($row['site']) ;
I know that the SELECT statement works and there is data in $row['site']. I also tried putting $row['site'] into a variable and calling the function on the variable, but it still doesn't work. What am I missing here? Any help would be appreciated.