Код:
";
if ($isTitle==3)
{
$pub_array=array();
$pub_array_cnt=0;
$pub_cnt=0;
$pub_query=mysql_query("SELECT a.Message_ID, a.Title, a.Titlelink, a.Date, d.smi_Name , SUBSTRING_INDEX(SUBSTRING_INDEX(a.Pic_list,':',1),'.',-1) as picext, SUBSTRING_INDEX(a.Pic_list,':',1) as picname, b.Hidden_URL, c.EnglishName FROM Message76 AS a, Subdivision AS b, Sub_Class AS c, Classificator_smi AS d WHERE a.Subdivision_ID = b.Subdivision_ID AND a.Sub_Class_ID = c.Sub_Class_ID AND a.smi=d.smi_ID AND a.active_show=1 AND a.start_show<NOW() AND a.end_show>NOW() AND a.Checked=1 ORDER BY a.start_show DESC LIMIT 3");
if ($pub_query)
{
for($i=0;$i<mysql_num_rows($pub_query);$i++)
{
$pub_result=mysql_fetch_array($pub_query);
$result.="<td width="33%" valign="top" align="left" class="news">
<a href="$pub_result[Hidden_URL]$pub_result[EnglishName]_$pub_result[Message_ID].html"><img src="/netcat_files/363_$pub_result[Message_ID].$pub_result[picext]" alt="" border="0"></a><div id="i5"></div>
<a href="$pub_result[Hidden_URL]$pub_result[EnglishName]_$pub_result[Message_ID].html" class="news_big">$pub_result[Title] $pub_result[Titlelink]</a><br>
".date("d.m.Y",strtotime($pub_result[Date]))."</td>";
$pub_array[$pub_array_cnt]=$pub_result[Message_ID];
$pub_array_cnt++;
$pub_cnt++;
}
}
$pub_img_cnt=0;
if ($pub_cnt<3)
{
$pub_img_query=mysql_query("SELECT a.Message_ID, a.Title, a.Titlelink, a.Date, d.smi_Name , SUBSTRING_INDEX(SUBSTRING_INDEX(a.Pic_list,':',1),'.',-1) as picext, SUBSTRING_INDEX(a.Pic_list,':',1) as picname, b.Hidden_URL, c.EnglishName FROM Message76 AS a, Subdivision AS b, Sub_Class AS c, Classificator_smi AS d WHERE a.Subdivision_ID = b.Subdivision_ID AND a.Sub_Class_ID = c.Sub_Class_ID AND a.smi=d.smi_ID AND Pic_list<>'' AND a.Checked=1 ORDER BY a.Date DESC");
if ($pub_img_query)
{
for($i=0;$i<mysql_num_rows($pub_img_query);$i++)
{
$pub_img_result=mysql_fetch_array($pub_img_query);
$pub_flag=0;
for($j=0;$j<$pub_array_cnt;$j++)
if ($pub_array[$j]==$pub_img_result[Message_ID])
$pub_flag=1;
if (!$pub_flag)
{
$pub_img_cnt++;
$result.="<td width="33%" valign="top" align="left">
<a href="$pub_img_result[Hidden_URL]$pub_img_result[EnglishName]_$pub_img_result[Message_ID].html"><img src="/netcat_files/363_$pub_img_result[Message_ID].$pub_img_result[picext]" alt="" border="0"></a><div id="i5"></div>
<span class=news>".date("d.m.Y",strtotime($pub_img_result[Date]))."</span><br>
<a href="$pub_img_result[Hidden_URL]$pub_img_result[EnglishName]_$pub_img_result[Message_ID].html" class="news_big">$pub_img_result[Title] $pub_img_result[Titlelink]</a><br>
</td>";
$pub_array_cnt++;
if ($pub_cnt+$pub_img_cnt>=3)
break;
}
}
}
}
}
$result .= "