RaitisRR Posted January 10, 2011 Report Share Posted January 10, 2011 Sveiki ar šo kodu izvelku no foruma ziņas , ierobežoju to garumu. Kodz paredzēts lai web lapā varu redzēt jaunākos rakstus forumā. Jautājums tāds - kā būtu iespējams izdrukāt tikai 4 ziņas un kad ir jauna ziņa lai tā parādītos vecākas ziņas vietā. <?php function sb($t,$len="100"){ if(strlen($t) > $len){ $t = substr($t, 0, $len)."..."; } return $t; } $result3 = mysql_query("SELECT * FROM phpbb_posts ORDER BY `post_id` ASC LIMIT 25 ") or die("Nevar savienoties ar tabulu!"); while ($row3 = mysql_fetch_assoc($result3)) { ?> <td><b><a href="/forum/viewtopic.php?t=<?php echo $row3['post_id']; ?>" class="style36"><?php echo $row3['post_subject']; ?></a></b></td> <tr><td class="style35"><?php $x=$row3['post_text']; echo $x=sb($x, 97); echo "<hr>" ?> </td></tr> <?php } ?> Quote Link to comment Share on other sites More sharing options...
rebuilder Posted January 10, 2011 Report Share Posted January 10, 2011 varbūt LIMIT 4 ? O_o Quote Link to comment Share on other sites More sharing options...
Kemito Posted January 11, 2011 Report Share Posted January 11, 2011 Sveiks. Pēc skata tas ir phpbb lapeles addons vai kas. Šitā vietā: $result3 = mysql_query("SELECT * FROM phpbb_posts ORDER BY `post_id` ASC LIMIT 25 ") or die("Nevar savienoties ar tabulu!"); Šito: $result3 = mysql_query("SELECT * FROM phpbb_posts ORDER BY `post_id` ASC LIMIT 4 ") or die("Nevar savienoties ar tabulu!"); 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.