$result = json_decode($result); $num = count($result); $arr[] = null; for ($i = 0; $i < $num; $i++) { $arr[$i]['id'] = $result[$i]->id; $arr[$i]['nombre'] = $result[$i]->nombre; } //die(var_dump($arr)); //die(var_dump(Funciones::armarCombo($arr))); ?> <div class="form-group"> <label class="col-sm-2 col-sm-2 control-label">Género</label> <div class="col-sm-10"> <select id="id_musicgenre" name="id_musicgenre" class="form-control round-form"> <?php echo Funciones::armarCombo($arr); ?> </select> </div> </div> <input id="id_typemusic" name="id_typemusic" type="hidden" value="1"> <div class="form-group"> <label class="col-sm-2 col-sm-2 control-label">Descripción</label> <div class="col-sm-10"> <input id="description" name="description" type="text" class="form-control round-form"> </div> </div> <div class="form-group"> <label class="col-sm-2 col-sm-2 control-label">Ruta de la pista</label> <div class="col-sm-10"> <input id="ruta" name="ruta" type="text" class="form-control round-form">
case 'combo': $objDB = new Class_Db(); $con = $objDB->selectManager()->connect(); $query = "SELECT id_" . $_POST['table'] . " as id,nombre FROM " . $_POST['table'] . " where id_" . $_POST['padre'] . " = " . $_POST['input']; $tabla = $objDB->selectManager()->select($con, $query); $html = Funciones::armarCombo($tabla); if (!empty($tabla)) { echo json_encode(["type" => "success", "html" => $html]); } else { echo json_encode(["type" => "empty", "html" => null]); } break; case 'cbo_tipo': $objDB = new Class_Db(); $con = $objDB->selectManager()->connect(); $procedure = "sp_combo_tipo"; $input = $_POST['categoria']; $tabla = $objDB->selectManager()->spSelect($con, $procedure, $input); $html = Funciones::armarCombo($tabla); if (!empty($tabla)) { echo json_encode(["type" => "success", "html" => $html]); } else { echo json_encode(["type" => "empty", "html" => null]); } break; case 'renueva_token': $_SESSION['sessionID'] = null; break; default: break; }