fields['TitlesOfDogId'])) { $TitlesOfDog = addslashes($ti->fields['TitlesOfDog']); } else { $TitlesOfDog = ""; } Note: With fetch by name having different table names in the query, the prefix of a table name (or alias) is dropped. $sql = "SELECT BJId, BJJudge FROM BreedJudges WHERE BJId = " . $BreedJudge; sc_select(ju1, $sql); if (isset($ju1->fields[0])) { $JudgeAtRegistration = $ju1->fields[1]; } ?>