OK, I really don’t what to call this, that’s why I have to post this thread, 'cause I don’t know what to look for.
What I want to do is grab text from my (existing) news tabel (in a MySQL DB) and only display a defined number of rows (or chars). In other words, I want to show just a pice of the entire text on my first page, then when they click on the “read more” link at the bottom of the text they come to the news section of the site (or make it so the entire text is shown).
I don’t know if I’m explaining it bad… but I’m talking about making a news “section” on the first page, that just lists SOME (like 2-3 of the most resent) of the news. And then have an archive for the rest.
Thanks for any code or links to tutorials on this :hugegrin:
*EDIT
sry… this is the code i have right now
<?php
$limit = 2;
$query = "SELECT * FROM news ORDER BY id DESC LIMIT 0, $limit";
$result = mysql_query($query) or die("Error: " . mysql_error());
if(mysql_num_rows($result) == 0){
echo("För tillfället finns det finns inga nyheter!");
}
echo("<table width=490 border=0 cellspacing=0 cellpadding=0 class=txt>");
while($query=mysql_fetch_array($result))
{
extract($query);
$bbcode=array("
" => “<br>”);
$braker = str_replace(array_keys($bbcode), array_values($bbcode), $txt);
echo
("<tr>
<td height=‘25’><b>$head</b></td>
</tr>
<tr>
<td>$braker</td>
</tr>
<tr>
<td>$more</td>
</tr>");
}
echo("</table>");
echo("<br> </br>");
?>
What I need to do is define that the “txt” variable doesnt get longer then 2-3 rows.