ziedinjsh Posted August 24, 2012 Report Share Posted August 24, 2012 Sveiki! Datubāzē man ir divi ieraksti bet rāda tikai vienu php: $music = mysql_query("select * from music where uid='".$data['id']."'") or die(mysql_error()); while($data = mysql_fetch_array($music)){ $link = $data['link']; ?> <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script> <script type='text/javascript'> $(window).load(function(){ var url="<?php echo $link; ?>"; $.ajax({ type: "GET" ,dataType: "json" ,data: { jsonp : "output" ,url: url ,format: "json" ,iframe: "true" } ,url : "http://soundcloud.com/oembed" ,success: function(data) { $('#player').html(data.html); } }); }); </script> <div id="player"></div> <?php } kapēc tā? Quote Link to comment Share on other sites More sharing options...
briedis Posted August 24, 2012 Report Share Posted August 24, 2012 (edited) ..varbūt tur arī ir tikai viens ieraksts? Tev nav kāds phpmyadmin? Ieraksti tur to pašu kvēriju un paskaties, kas īsti tiek atgriezts. Tu zināji, ka elementa ID jābūt unikālam? Nedrīkst būt vairāki <div id="player">! Edited August 24, 2012 by briedis Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted August 24, 2012 Author Report Share Posted August 24, 2012 phpmy admin skatījos.. ir divi ieraksti.. tā pat pārbaudiju echo $link; parāda divus ierakstus; tā.. kā tad īsti bija r tiem id.. iekš div es ierakstīšu <div id="player'.$data['id'].'"></div> kā bija pareizi norādīt to iekš tā ajax koda? Quote Link to comment Share on other sites More sharing options...
briedis Posted August 24, 2012 Report Share Posted August 24, 2012 Parādi to HTML, kas tiek uzģenerēts. Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted August 24, 2012 Author Report Share Posted August 24, 2012 lapā parāda vienu plejeri, bet source failā ir divi.. tad tikai vajag to #player kkā uztaisīt lai liktu klāt arī ieraksta id id="player'.$data['id'].'" kkā tā <script type='text/javascript'> $(window).load(function(){ var url="http://soundcloud.com/epic8/epic8-will-never-be-the-same"; $.ajax({ type: "GET" ,dataType: "json" ,data: { jsonp : "output" ,url: url ,format: "json" ,iframe: "true" } ,url : "http://soundcloud.com/oembed" ,success: function(data) { $('#player').html(data.html); } }); }); </script> <div id="player"></div> <script type='text/javascript'> $(window).load(function(){ var url="http://soundcloud.com/epic8/epic8-cave"; $.ajax({ type: "GET" ,dataType: "json" ,data: { jsonp : "output" ,url: url ,format: "json" ,iframe: "true" } ,url : "http://soundcloud.com/oembed" ,success: function(data) { $('#player').html(data.html); } }); }); </script> <div id="player"></div> Quote Link to comment Share on other sites More sharing options...
briedis Posted August 24, 2012 Report Share Posted August 24, 2012 (edited) Tavs kods ir sūds. Tev nav sajūta, ka to visu varētu izdarīt bez tā milzīgā javascript koda kopēšanas atkal un atkal? Zināji, ka iekš javascript arī ir tādi cikli un masīvi? Edited August 24, 2012 by briedis Quote Link to comment Share on other sites More sharing options...
reiniger Posted August 25, 2012 Report Share Posted August 25, 2012 ... $('#player').html(data.html); ... <div id="player"></div> ... $('#player').html(data.html); ... <div id="player"></div> Kā tu domā ja tev ir ID variāki, kaut arī labi ja ir tikai viens un unikāls html. Viņš spēj atšķirt kurā #player dati jaielik. Protams ka viņš atrod pirmo #player un tur ievieto vispirms pirmo un tad otro un rezultātā tev rādas tikai viens. ... $('#player1').html(data.html); ... <div id="player1"></div> ... $('#player2').html(data.html); ... <div id="player2"></div> Pamēģini šādi varbūt rādīsies divi tavi player. Quote Link to comment Share on other sites More sharing options...
aaxc Posted August 25, 2012 Report Share Posted August 25, 2012 Tavs kods ir sūds... Kā būtu, ja mēs palīdzētu cilvēkiem pārmaiņas pēc? Quote Link to comment Share on other sites More sharing options...
briedis Posted August 25, 2012 Report Share Posted August 25, 2012 Kā būtu, ja mēs palīdzētu cilvēkiem pārmaiņas pēc? Es pārmaiņas pēc arī palīdzu. Pēc savas sūda replikas devu norādes, kas būtu jāpapēta - javascript cikli, masīvi. Varbūt cilvēkam notiktu `klikšķis` un kaut kas aizietu. Nu nevar jau katru reizi uzrakstīt visu kodu priekšā... Quote Link to comment Share on other sites More sharing options...
briedis Posted August 25, 2012 Report Share Posted August 25, 2012 Es padotu masīvu vienkārši ar json_encode, un tad izciklētos ar JS... Quote Link to comment Share on other sites More sharing options...
Mr.Key Posted August 25, 2012 Report Share Posted August 25, 2012 (edited) ... (nu labi, lai būtu) Edited August 25, 2012 by Mr.Key Quote Link to comment Share on other sites More sharing options...
daGrevis Posted August 26, 2012 Report Share Posted August 26, 2012 > KOPŠ KURA LAIKA KOMATU LIEK RINDAS SĀKUMĀ? ESMU KAUT KO PALAIDIS GARĀM? Esi, esi. Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted August 26, 2012 Author Report Share Posted August 26, 2012 Zinu, ka tas ir smieklīgi Jums, bet man galīgi nesanāk viņu sasaistīt ar while $links = array( while($data = mysql_fetch_array($music)){ array('id' => $data['id'], 'url' => $data['link']), } ); kā savādāk var izvadīt datus iekš array?? Quote Link to comment Share on other sites More sharing options...
waplet Posted August 26, 2012 Report Share Posted August 26, 2012 (edited) $links = array(); while($data = mysql_fetch_array($music)){ $links[] = array('id' => $data['id'], 'url' => $data['link']); } Tu kaut kā astronomiski nepareizi domā!!! Edited August 26, 2012 by waplet Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted August 26, 2012 Author Report Share Posted August 26, 2012 Es par to nešaubos Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.