Blumish Posted March 20, 2010 Report Share Posted March 20, 2010 (edited) Sveiki! Seit ir php kods kas izvelk pilniigi uz dullo vienu ierakstu no datubazes: <?php$query = mysql_query("SELECT * FROM anekdotes WHERE redz=1"); $nume= mysql_num_rows($query); $random = rand(1, $nume); $lol = mysql_query("SELECT * FROM anekdotes WHERE id='".$random."'"); while($dada = mysql_fetch_array($lol)) { echo' <font size="4"><b>Pasmaidi: </b>'.$dada['anekdote'].'</font> '; } ?> Man ir vajadzigs sim kodam klaat kods kas parladee so tekstu. Ar so kodu raadas kaads teksts, un vajadzeetu lai zem taa teksta buutu podzinja kuru uzpiezot, tiek izvilkts cits teksts no db un ieprieksejais pazustu.. Cerams ka saprataat mani! Paldies. Edited March 20, 2010 by Blumish Quote Link to comment Share on other sites More sharing options...
anonīms Posted March 20, 2010 Report Share Posted March 20, 2010 kas tas par greizu kodu? $anekdote = mysql_result(mysql_query("SELECT anekdote FROM anekdotes ORDER BY RAND()LIMIT 1"),0,0); echo $anekdote; to panākšanu var ar to pašu jquery. $.load funkciju. Quote Link to comment Share on other sites More sharing options...
2easy Posted March 20, 2010 Report Share Posted March 20, 2010 (edited) šis ir 1) mācību topiks? 2) "cita vietā izdarīšanas" topiks? 3) darba piedāvājuma topiks? Edited March 20, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
Blumish Posted March 20, 2010 Author Report Share Posted March 20, 2010 es vienkarsi jums pajautaaju reload kodu.. Quote Link to comment Share on other sites More sharing options...
anonīms Posted March 20, 2010 Report Share Posted March 20, 2010 Blumish. jquery ar $.load funkciju. <a href="#" onlick="reload();">reload</a> function reload() { $("aaa").load("anekdotes.php"); } Quote Link to comment Share on other sites More sharing options...
Blumish Posted March 20, 2010 Author Report Share Posted March 20, 2010 Blumish. jquery ar $.load funkciju. <a href="#" onlick="reload();">reload</a> function reload() { $("aaa").load("anekdotes.php"); } hmm man tas kods nestradaa.. izdariiju tac pareizi ja? <a href="#" onlick="reload();">reload</a><? function reload() { $("anekdotes").load("lapas/anekdotes/random.php"); } ?> Quote Link to comment Share on other sites More sharing options...
anonīms Posted March 20, 2010 Report Share Posted March 20, 2010 OK :D a tu maz paskatījies, ka ir jquery un vai tev .JS ir? Iedomājes, jquery ir nevis <?, bet gan <script> Quote Link to comment Share on other sites More sharing options...
2easy Posted March 20, 2010 Report Share Posted March 20, 2010 tāpēc, ka tev nav ne jquery, ne <div id="anekdotes"> nju nav tas TIK vnkārši, kā iemest kkur savā lapā no foruma nokopētu kodu... Quote Link to comment Share on other sites More sharing options...
anonīms Posted March 20, 2010 Report Share Posted March 20, 2010 (edited) Blumish, ja tev ir zz, tad zini - man sāk trūkt kredīts :D Par 50santīmiem šo var sarunāt. Skype: lazdas2 Edited March 20, 2010 by anonīms Quote Link to comment Share on other sites More sharing options...
Blumish Posted March 20, 2010 Author Report Share Posted March 20, 2010 nestrada :( luuk saadi: <a href="#" onlick="reload();">reload</a><script> function reload() { $("anekdotes").load("lapas/anekdotes/random.php"); } </script> un <head> daljaa ir: <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> Not work! Quote Link to comment Share on other sites More sharing options...
chizijs Posted March 20, 2010 Report Share Posted March 20, 2010 Un tu to jquery-1.3.2.min.js ielika mapē js ? Quote Link to comment Share on other sites More sharing options...
anonīms Posted March 20, 2010 Report Share Posted March 20, 2010 (edited) Nu kāda starpība ielika vai neielika. Vaina tāpat ir citur nav load id atribūts pareizi uzrakstīts un nav pats div's Edited March 20, 2010 by anonīms Quote Link to comment Share on other sites More sharing options...
Blumish Posted March 20, 2010 Author Report Share Posted March 20, 2010 itkaa visu saliku, bet vins man raada kkaadu erroru: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\lapas\anekdotes\random.php on line 5 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\lapas\anekdotes\random.php on line 8 Luuk random kods: <?php$query = mysql_query("SELECT * FROM anekdotes WHERE redz=1"); $nume= mysql_num_rows($query); $random = rand(1, $nume); $lol = mysql_query("SELECT * FROM anekdotes WHERE id='".$random."'"); while($dada = mysql_fetch_array($lol)) { echo' <font size="4"><b>Pasmaidi: </b>'.$dada['anekdote'].'</font> '; } ?> Nesaprotu kas pa vainu, mekleju google, bet neko jedzigu neatradu Quote Link to comment Share on other sites More sharing options...
waplet Posted March 20, 2010 Report Share Posted March 20, 2010 nokopē no manis Quote Link to comment Share on other sites More sharing options...
anonīms Posted March 20, 2010 Report Share Posted March 20, 2010 un ko saka mysql_error() ? 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.