runei Posted November 5, 2008 Share Posted November 5, 2008 Hello. I have got a fraction of the script showing under. The limit funtion sort of works but it only returns one id for every category. As it is it should return two right? I also need help on how you go about extracting eg; the first three lines from a field in the table. If the field is a message field in a forum the user might write a long entry, and i do not want the whole entry showing on the frontpage, just the last two entries and eg; the 3-4 first lines of the message. $sql7 = "SELECT * FROM forum_topics WHERE categoryid ='".$row3['id']."'ORDER BY date DESC LIMIT 0, 2"; $result7 = mysql_query($sql7) or die (mysql_error()); if (mysql_num_rows($result7)== 0){ echo "error"; }else{ $row7 = mysql_fetch_assoc($result7); echo "'".$row7['id']."'"; } thx runei Link to comment https://forums.phpfreaks.com/topic/131514-solved-order-by-date-and-limit/ Share on other sites More sharing options...
Yesideez Posted November 5, 2008 Share Posted November 5, 2008 Not sure what you're asking for but as fgor only displaying the first couple of lines of text why not extract the first x number of characters from the text and display that? http://uk2.php.net/manual/en/function.substr.php Something like this to display the first 300 characters: echo trim(substr($txt,0,300)); trim() is used just in case there's a space or carriage return on the end. Link to comment https://forums.phpfreaks.com/topic/131514-solved-order-by-date-and-limit/#findComment-683041 Share on other sites More sharing options...
runei Posted November 5, 2008 Author Share Posted November 5, 2008 thx bud. when i did this echo trim(substr($row7['title'],0,10)); it worked like a charm. Niiiiice Link to comment https://forums.phpfreaks.com/topic/131514-solved-order-by-date-and-limit/#findComment-683065 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.