До 30 символа от заглавието на темата

topchokt

Registered
Здравейте,
това ми е кода който извежда последните теми от форума:

Код:
<?php

/*** Invision Power Board - Last Topics System ***/

//Author: Vasil Antonov

//Email: vasko_an@abv.bg

//Date: 21.05.2004

//------------------------------

//Edit these parameters:

//MySQL server adress
$host="localhost";

//Username
$user="";

//Password
$pass="";

//Database
$db="";

//Table
$table="ibf_topics";

//Show last x posts
$laforums="7";


//-------------------------- END

//------------------------------

//Don't edit !

$link=mysql_connect($host, $user, $pass);
$db=mysql_select_db($db);
$query="select * from $table order by start_date desc limit 0,$laforums";
$result=mysql_query($query, $link);
while ($row=mysql_fetch_row($result)) {
    echo "<a href='/forums/index.php?showtopic=$row[0]' target='_blank'>$row[1]</a><br>";
}

//-------------------------- END
?>
Та как може да стане да показва само до 30 символа от заглавието на темата , не цялото , защото таблицата е малка ?


Благодаря предварително :)
 
Код:
<?php 

/*** Invision Power Board - Last Topics System ***/ 

//Author: Vasil Antonov 

//Email: vasko_an@abv.bg 

//Date: 21.05.2004 

//------------------------------ 

//Edit these parameters: 

//MySQL server adress 
$host="localhost"; 

//Username 
$user=""; 

//Password 
$pass=""; 

//Database 
$db=""; 

//Table 
$table="ibf_topics"; 

//Show last x posts 
$laforums="7"; 


//-------------------------- END 

//------------------------------ 

//Don't edit ! 

$link=mysql_connect($host, $user, $pass); 
$db=mysql_select_db($db); 
$query="select * from $table order by start_date desc limit 0,$laforums"; 
$result=mysql_query($query, $link); 
while ($row=mysql_fetch_row($result)) { 
    echo "<a href='/forums/index.php?showtopic=$row[0]' target='_blank'>" . substr($row[1], 0, 30) . "</a><br>"; 
} 

//-------------------------- END 
?>
 

Back
Горе