function showOptions($sql) { $service = new BaseService(); $results = $service->GetRows($sql); $id = 0; $i = 0; foreach ($results as $row) { if ($i == 0) { $id = $row[0]; } echo "<option value='" . $row[0] . "'>" . $row[1] . "</option>"; $i++; } return $id; }