<table width=580px align="top" border="10">
<tr>
<td><a href="dodaj.php"><img src="html/dodaj.jpg"></a></td>
<tr bgcolor="#FF6600">
<td>kategoria 1</td>
<tr>
<td>
<table width=580>
<?php
[b]include("polacz.php");[/b]
$query = mysql_query("select * from news WHERE `kat_id` = '1'"); {
$naz .= '<table><img src="html/f_6.jpg"><a href="news.php?id='.$rekord[0].'">'.$rekord[1].'</a> Autor: '.$rekord[3].' - '.$rekord[2].'<br><center><img src="html/linia.jpg"></center></br></table>';
echo '<tr>'.$naz.'</tr>';
}
?>
</td>
<tr>
<td><a href="ekstra.php">(więcej)</a></td>
</tr>
<tr bgcolor="#FF6600">
<td>kategoria 2</td>
<tr>
<td>
<table width=580>
<?php
[b]include("polacz.php");[/b]
$query = mysql_query("select * from news WHERE `kat_id` = '2'"); {
$naz .= '<table><img src="html/f_1.gif"><a href="news.php?id='.$rekord[0].'">'.$rekord[1].'</a> Autor: '.$rekord[3].' - '.$rekord[2].'<br><center><img src="html/linia.jpg"></center></br></table>';
echo '<tr>'.$naz.'</tr>'; }
?>
</td>
</tr>
<tr bgcolor="#FF6600">
<td>kategoria 3</td>
<tr>
<td>
<table width=580>
<?php
[b]include("polacz.php"); [/b]
$query = mysql_query("select * from news WHERE `kat_id` = '3'"); {
$naz .= '<table><img src="html/f_2.jpg"><a href="news.php?id='.$rekord[0].'">'.$rekord[1].'</a> Autor: '.$rekord[3].' - '.$rekord[2].'<br><center><img src="html/linia.jpg"></center></br></table>';
echo '<tr>'.$naz.'</tr>'; }
?>
</td>
</tr>
<tr bgcolor="#FF6600">
<td>kategoria 4</td>
<tr>
<td>
<table width=580>
<?php
[b]include("polacz.php"); [/b]
$query = mysql_query("select * from news WHERE `kat_id` = '4'"); {
$naz .= '<table><img src="html/f_3.jpg"><a href="news.php?id='.$rekord[0].'">'.$rekord[1].'</a> Autor: '.$rekord[3].' - '.$rekord[2].'<br><center><img src="html/linia.jpg"></center></br></table>';
echo '<tr>'.$naz.'</tr>'; }
?>
</td>
</tr>
<tr bgcolor="#FF6600">
<td>kategoria 5</td>
<tr>
<td>
<table width=580>
<?php
[b]include("polacz.php"); [/b]
$query = mysql_query("select * from news WHERE `kat_id` = '5'"); {
$naz .= '<table><img src="html/f_4.jpg"><a href="news.php?id='.$rekord[0].'">'.$rekord[1].'</a> Autor: '.$rekord[3].' - '.$rekord[2].'<br><center><img src="html/linia.jpg"></center></br></table>';
echo '<tr>'.$naz.'</tr>'; }
?>
</td>
</tr>
<tr bgcolor="#FF6600">
<td>kategoria 6</td>
<tr>
<td>
<table width=580>
<?php
[b]include("polacz.php"); [/b]
$query = mysql_query("select * from news WHERE `kat_id` = '6'"); {
$naz .= '<table><img src="html/f_5.jpg"><a href="news.php?id='.$rekord[0].'">'.$rekord[1].'</a> Autor: '.$rekord[3].' - '.$rekord[2].'<br><center><img src="html/linia.jpg"></center></br></table>';
echo '<tr>'.$naz.'</tr>'; }
?>
</td>
</tr>
</table>
</table>
</table></table></table></table></table>
Jak zapisać ten kod żeby tylko raz się łączyć z bazą a nie kilka razy jak jest w moim przykładzie