v2.5.2
Giriş yap

koşulu yerleştirmek

pcmemo
833 defa görüntülendi
function CategoryTree(&$output=null, $CatParID=0, $indent=null){
  // conection to the database
  $db = new PDO("mysql:host=localhost;dbname=spot", 'root', 'root');
  // select the categories that have on the CatParID column the value from $CatParID
  $r = $db->prepare("SELECT CatID, KategoriAdi FROM tbl_kategori WHERE CatParID=:CatParIDid");
  $r->execute(array(
    'CatParIDid'  => $CatParID
  ));
  // show the categories one by one
  while($c = $r->fetch(PDO::FETCH_ASSOC)){
    $output .= '<option value=' . $c['CatID'] . 'xxxxxxxxxxxxxxx>' . $indent . $c['KategoriAdi'] . "</option>";
    if($c['CatID'] != $CatParID){
      // in case the current category's id is different that $CatParID
      // we call our function again with new parameters
      CategoryTree($output, $c['CatID'], $indent . "---------");
    }
  }

aşağıdaki kodu yukarındaki xxxxxxxxxxxx li yere yerleştirmem lazım. Olmadı bir türlü.

  if ($c['CatID'] == $kat['CatParID']) { echo 'selected/';} 
pcmemo
1455 gün önce

@makifgokce teşekkür ederim.
denedim, dropdown menünün içeriği tamamen kayboldu. Kendi var içerik yok. :(