написал) работает, подкиньте идеи как внизу страницы доделать
<?php
$dbc = new PDO('mysql:host=localhost;dbname=vetbase', 'root', '111');
$resCount = $dbc->prepare( "SELECT COUNT(*) AS numRecord FROM news" );
$resCount->execute();
$rowCount = $resCount->fetch( PDO::FETCH_ASSOC );
$num =4;
if(isset($_GET['page'])) {
$start = intval($_GET['page']) * $num - $num;
}
else {
$start = 0;
}
$dbc = new PDO('mysql:host=localhost;dbname=vetbase', 'root', '111');
$resNews = $dbc->prepare( "SELECT * FROM news LIMIT :start, :num" );
$resNews->bindValue(':start', (int) $start, PDO::PARAM_INT);
$resNews->bindValue(':num', (int) $num, PDO::PARAM_INT);
$resNews->execute();
$arr = array();
while($rowNews = $resNews->fetch( PDO::FETCH_ASSOC )) {
$arr[] = array(
'id' => $rowNews['id'],
'zagolovok' => $rowNews['zagolovok'],
'zagolovok2' => $rowNews['zagolovok2'],
'news_text' => $rowNews['news_text'],
'news_text_2' => $rowNews['news_text_2'],
);
}
?>
<style type="text/css">
td {border: 1px red dotted;}
</style>
<table>
<tr>
<td>ID</td>
<td>Title</td>
<td>Title 2</td>
<td>Body</td>
<td>Body 2</td>
</tr>
<?php
foreach($arr as $article) {
print "<tr>
<td>" . $article['id'] . "</td>
<td>" . $article['zagolovok'] . "</td>
<td>" . $article['zagolovok2'] . "</td>
<td>" . $article['news_text'] . "</td>
<td>" . $article['news_text_2'] . "</td>
</tr>";
}
?>