reGative Posted April 5, 2010 Report Share Posted April 5, 2010 Sveiki, Kodēju es savu blogu, un pievienoju lasīt tālāk funkciju. Princips šāds - ievades formā ir divi teksta lauki - ievadam un galvenajam tekstam. un tālāk izveidoju linku index.php?lasiit=&id . &id vietā ir attiecīgā raksta id, kuru vēlos lasīt tālāk. Bet man atverās vienkārši links piemēram index.php?lasiit=3 (3 ir id) nu un viņš ielādē, bet lapā nekas nemainās. esmu izmantojis GET komandas un echo, bet tas nelīdz. Plašāka info - Ievads echo "<b class='title'>" . $row['virsraksts'] . "</b><br />"; echo "Autors: <b>" . $row['autors'] . "</b> Ievietots: " . $row['datums'] . "<br />"; echo "<p>" . $row['ievads'] . "</p><br />"; echo "<a href='index.php?lasiit="; echo $row['id']; echo "'>Lasīt tālāk</a>"; echo "<br />"; Galvenais teksts if(isset($_GET['lasiit']) and $_GET['lasiit'] == "$id") { echo $row['teksts']; } kas te ir nepareizi? paldies jau iepriekš. :) Quote Link to comment Share on other sites More sharing options...
chizijs Posted April 5, 2010 Report Share Posted April 5, 2010 Uzliec vienkārši if(isset($_GET['lasiit'])){ .. } Quote Link to comment Share on other sites More sharing options...
reGative Posted April 5, 2010 Author Report Share Posted April 5, 2010 (edited) chizijs, liels tev paldies, nostrādāja :) :) Bet tagad ja nospiežu "Lasīt tālāk" tad tas noreaģē uz visiem rakstiem. Un tas Lasīt tālāk links paliek. Edited April 5, 2010 by reGative Quote Link to comment Share on other sites More sharing options...
waplet Posted April 5, 2010 Report Share Posted April 5, 2010 (edited) and $_GET['lasiit'] == "$id" labi zini, ka šis izpildas? jā bet atbildi man arī :D saproti, kāpēc tev negāja! Edited April 5, 2010 by waplet Quote Link to comment Share on other sites More sharing options...
reGative Posted April 5, 2010 Author Report Share Posted April 5, 2010 (edited) nez, neesmu jau pro PHP :D bet nu tur vsp čakars, ja nospiež uz Lasīt tālāk, tad tas noreaģē uz visiem rakstiem. ehh... Edited April 5, 2010 by reGative Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted April 5, 2010 Report Share Posted April 5, 2010 Es nesaprotu kā var rakstīt kaut kādu kodu nesaprotot ko tas dara o_O Quote Link to comment Share on other sites More sharing options...
reGative Posted April 5, 2010 Author Report Share Posted April 5, 2010 labi, labi, tā jau nav. :D. Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted April 5, 2010 Report Share Posted April 5, 2010 (edited) uztais šādi Links: <a href='readmore.php?id=".$row['id']."'>Lasīt Vēl..</a> readmore.php $id = (isset($_GET['id'])) ? $_GET['id'] : ''; $row = mysql_fetch_array(mysql_query("SELECT * FROM news WHERE id ='$id'")); Edited April 5, 2010 by ziedinjsh Quote Link to comment Share on other sites More sharing options...
reGative Posted April 18, 2010 Author Report Share Posted April 18, 2010 Līdz šim man strādāja šī funkcija. Labi, vakar centos uzlikt komentāru sistēmu, neizdevās. Kods: <?php $id = (isset($_GET['id'])) ? $_GET['id'] : ''; require_once "includes/init.php"; $row = mysql_fetch_array(mysql_query("SELECT * FROM zinjas WHERE id ='$id'")); session_start(); $page = $row['virsraksts']; include("includes/config.php"); include("style/header.php"); echo "<p class='title'>" . $row['virsraksts'] . "</p>"; echo "<p>" . $row['ievads'] . "</p>"; echo "<p>" . $row['teksts'] . "</p>"; echo "<hr /><small>Autors: <b>" . $row['autors'] . "</b> Ievietots: " . $row['datums'] . "</small>"; include("style/sidebar.php"); include("style/footer.php"); ?> Tagad sākumlapā parādās ievads un viss, kā vajag, bet ja spiež uz "Lasīt tālāk", tad nekā nav parādīts, tākā informācijas datubāzē nebūtu, lai gan ir. Vai man ir kāda kļūda sintaksē? Quote Link to comment Share on other sites More sharing options...
m8t Posted April 18, 2010 Report Share Posted April 18, 2010 Nesapratu kādēļ šo tev tur vajag pa vidu: session_start(); Pamēģini: $lieta = mysql_query("SELECT * FROM zinjas WHERE id ='$id'") or die(mysql_error()); $row = mysql_fetch_array($lieta); ja būs kļūda sintaksē - redzēsi erroru Quote Link to comment Share on other sites More sharing options...
reGative Posted April 18, 2010 Author Report Share Posted April 18, 2010 hmm, ir tāds errors: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\rGv2\readmore.php on line 4 manu prāt, tas nozīmē, ka kkādi dati nesakrīt. Piem. šeit vēlamies izvilkt $row['bilde']; laigan datubāzē šādas ailes nav. Bet man tač viss tur ir kārtībā. Quote Link to comment Share on other sites More sharing options...
daGrevis Posted April 18, 2010 Report Share Posted April 18, 2010 Tas to nenozīmē. Quote Link to comment Share on other sites More sharing options...
reGative Posted April 18, 2010 Author Report Share Posted April 18, 2010 daGrevi, nu tad var būt paskaidro. Quote Link to comment Share on other sites More sharing options...
m8t Posted April 18, 2010 Report Share Posted April 18, 2010 Nezinu vai līdzēs, bet pamēģini: $lieta = mysql_query("SELECT * FROM zinjas WHERE id ='{$id}'") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
reGative Posted April 18, 2010 Author Report Share Posted April 18, 2010 Pilnīgi nekādu izmaiņu, diemžēl. 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.