while($thread_get=mysql_fetch_array(mysql_query("SELECT threadid,title,lastpost,lastposter FROM thread WHERE visible=1 AND open=1 ORDER BY lastpost DESC LIMIT 10"))) 
{ 
$sonmsj = $thread_get['lastpost']; 
$poster = $thread_get['lastposter']; 
$tid = $thread_get['threadid']; 
$psql = mysql_query("SELECT postid FROM post WHERE threadid=$tid ORDER BY postid DESC"); 
$getp=mysql_fetch_array($psql); 
$pid = $getp['postid']; 
$tarih2 = date ("m/d/y h:i A" ,$sonmsj); 
$baslik = $thread_get['title']; 
$baslik = substr($baslik,0,45); 
}