as comavtor, `fotos`.`title` as fototitle, `fotos`.`id_fotos` as idmap, `coments`.`id_chuvak` as idchuvak, `coments`.`id_foto` as idfoto, 0 as idgfoto, 0 as gfototitle FROM coments LEFT JOIN `fotos` ON `coments`.`id_foto` = `fotos`.`id_fotos` ORDER BY comdate DESC LIMIT 0,50) UNION (SELECT `galcom`.`comdate` as comdate, `galcom`.`comavtor` as comavtor, 0 as fototitle, 0 as idmap, `galcom`.`id_chuvak` as idchuvak, 0 as idfoto, `galcom`.`id_galeryfoto` as idgfoto, `galeryfoto`.`title` as gfototitle FROM galcom LEFT JOIN `galeryfoto` ON `galcom`.`id_galeryfoto` = `galeryfoto`.`id_galeryfoto` ORDER BY comdate DESC LIMIT 0,50) ORDER BY comdate DESC LIMIT 0,100"; $result = mysql_query($sql); $rows = mysql_num_rows($result); if ($rows > 0) { $showed = "***,"; $kvo = 0; for($i=1; $i<=$rows; $i++) { $myrow = mysql_fetch_array($result); $com1 = $myrow["comdate"]; $com2 = $myrow["comavtor"]; $com3 = $myrow["fototitle"]; $com4 = $myrow["idmap"]; $com5 = $myrow["idchuvak"]; $com6 = $myrow["idfoto"]; $com7 = $myrow["idgfoto"]; $com8 = $myrow["gfototitle"]; $com8 = trim($com8); $com1 = strtotime($com1); $com1 = $com1 - 3600; $com1 = date("Y-m-d H:i:s", $com1); if ($com5 == 0) { if (strlen($com2) > 17) {$com2 = substr(trim($com2),0,16)."..";} $com5 = "$com2"; } else { if (strlen($com2) > 15) {$com2 = substr(trim($com2),0,14)."..";} $com5 = "$com2"; } $cd = substr($com1,0,10); if ($cd == $t_day) { $com1 = substr($com1,11,8); } else { $com1 = substr($com1,0,10); } if ($kvo<30) { i