Witajcie,
Mam problem z funkcją, która powinna zaznaczać select przez explode'owane dane.
<?php
function rezerwowi()
{
$this->wyciaganie();
$this->rezerwowibaza = $this->row['zmiany_mecze'];
$this->rezer = explode("ćó" , $this->rezerwowibaza);
$this->rezer1 = $this->rezer[0];
$this->rezer2 = $this->rezer[3];
$this->rezer3 = $this->rezer[4];
$this->rezer4 = $this->rezer[5];
$this->rezer5 = $this->rezer[2];
$this->rezer6 = $this->rezer[1];
$this->rezer7 = $this->rezer[6];
$this->rezer8 = $this->rezer[9];
$this->rezer9 = $this->rezer[10];
$this->rezer10 = $this->rezer[11];
$this->rezer11 = $this->rezer[8];
$this->rezer12 = $this->rezer[7];
$this->rezer13 = $this->rezer[12];
$this->rezer14 = $this->rezer[15];
$this->rezer15 = $this->rezer[16];
$this->rezer16 = $this->rezer[17];
$this->rezer17 = $this->rezer[14];
$this->rezer18 = $this->rezer[13];
$this->rezer19 = $this->rezer[18];
$this->rezer20 = $this->rezer[21];
$this->rezer21 = $this->rezer[22];
$this->rezer22 = $this->rezer[23];
$this->rezer23 = $this->rezer[20];
$this->rezer24 = $this->rezer[19];
echo "<select name=nam>"; $this->pytaniea10="SELECT * FROM zawodnicy ORDER BY nazwisko_zawodnicy ASC ";
or
die ("błąd zapytania "); if ($this->row3a10['id_zawodnicy'] == $this->rezer1) $this->zaznacz="selected"; else $this->zaznacz="";
echo "<option value='".$this->row3a10['id_zawodnicy']."' ".$this->zaznacz.">".$this->row3a10['nazwisko_zawodnicy']." ".$this->row3a10['imie_zawodnicy']."</option>"; }
}
?>
Problem tkwi w $this->rezer1 . Otóż kiedy jest wywoływana jego wartość, pokazuje się ona zgodnie z prawdą. Kiedy pobieram dane z WHERE id_zawodnicy = $this->rezer1, także działa. Jednak w wypadku, w którym ma zaznaczać dodane wcześniej pole, $this->rezer1 przybiera pustą wartość. Dlaczego tak się dzieje, bo moja walka przypomina tą z Don Kichote z wiatrakami.