Kod
$dane = $pdo -> query('SELECT id,title,wstep,rozwiniecie,data FROM news');
$news[] = array();
while ($row = $dane->fetch()) {
$news[] = array(
"id" => $row['id'],
"tytul" => $row['title'],
"wstep" => $row['wstep'],
"data" => $row['data']
);
}
print_r($news);
$tpl -> assign("News", $news);
$news[] = array();
while ($row = $dane->fetch()) {
$news[] = array(
"id" => $row['id'],
"tytul" => $row['title'],
"wstep" => $row['wstep'],
"data" => $row['data']
);
}
print_r($news);
$tpl -> assign("News", $news);
W tpl mam:
Kod
{section=News}
<a name="{$News.id}"></a>
<h1>Tytul:{$News.tytul}</h1>
<p>{$News.wstep}
<h3>Blockquote</h3>
<blockquote><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy
nibh euismod tincidunt ut laoreet dolore magna aliquam erat....</p></blockquote>
<p class="comments align-right clear">
<a href="http://localhost/VC/news/{$News.id}">Więcej</a> :
<a href="index.html">comments(3)</a> :
{$News.data}
</p>
<a name="{$News.id}"></a>
<h1>Tytul:{$News.tytul}</h1>
<p>{$News.wstep}
<h3>Blockquote</h3>
<blockquote><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy
nibh euismod tincidunt ut laoreet dolore magna aliquam erat....</p></blockquote>
<p class="comments align-right clear">
<a href="http://localhost/VC/news/{$News.id}">Więcej</a> :
<a href="index.html">comments(3)</a> :
{$News.data}
</p>
Wszystko się wyświetla ok, ale jest jeden - pusty wpis którego się nie mogę pozbyć.
Screen:
http://img141.imageshack.us/img141/6221/20...24180558ny9.png
Tablica wygląda tak:
Array ( [0] => Array ( ) [1] => Array ( [id] => 1 [tytul] => Lalala [wstep] => lalaaaaaaaaaaaaaaaaaaa [data] => 0000-00-00 00:00:00 ) [2] => Array ( [id] => 2 [tytul] => Bumsiakalaa [wstep] => BAAAAA NO BA [data] => 0000-00-00 00:00:00 ) )
Jak się pozbyć tego "najsłabszego" ogniwa?
Domyślam się, że trzeba wywalić [0] => array, ale nie mam pomysłu JAK.