"
with this code i get what i need but in one Way, from the top to down.
I mean from Gruppe1 to Gruppe2 to Gruppe3.....to..
but from Gruppe2 to Gruppe1 is not possible.
How can i do to get the same result without taking care of trom where i beginn.
PHP-Code:
function
select_list($fieldname,$Selected_Value,$Guppe1="",$Gruppe2="",$Gruppe3="",$Gruppe4="") {
$db = odbc_connect('mac_dbf','', ' ');
if ($Gruppe1) $where .= "Gruppe1 = '$Gruppe1' AND ";
if ($Gruppe2) $where = "Gruppe2 = '$Gruppe2' AND ";
if ($Gruppe3) $where .= "Gruppe3 = '$Gruppe3' AND ";
if ($Gruppe4) $where .= "Gruppe4 = '$Gruppe4' AND ";
if ($where) $where = "WHERE ".substr($where,0,strlen($where)-4);
echo "$where <br>";
$sql = "SELECT $fieldname FROM mac_dbf $where GROUP BY $fieldname ";
$result = odbc_exec($db, $sql);
$num_fields = odbc_num_fields($result);
$Option = "<option value=\"\">*</option>\n";
while (odbc_fetch_row ($result)) {
for ($i = 1; $i <= $num_fields; ++$i) {
$row = odbc_result($result,$i);
$field_name = odbc_field_name($result,$i);
if ($Selected_Value == $row) $selected = "selected";
else $selected = "";
$Option .= "<option $selected>$row</option>\n ";
}
}
odbc_free_result($result);
odbc_close($db);
return $Option;
}
EDIT:
plz use the php-tags by posting some code. this looks like better....
Abraxax
with this code i get what i need but in one Way, from the top to down.
I mean from Gruppe1 to Gruppe2 to Gruppe3.....to..
but from Gruppe2 to Gruppe1 is not possible.
How can i do to get the same result without taking care of trom where i beginn.
Kommentar