All pastes #175420 Raw Edit

Untitled

public text v1 · immutable
·published 2006-09-18 19:53 UTC
rendered paste body
<?php
/*
This file is part of SwishCMS
Copyright (C) 2006  SwishCMS Development Team

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
// Get main post.
$sql = $dbfunctions->sqlconnect();
$query = 'SELECT * FROM news WHERE id=' . $_GET['id'] . ' ORDER BY id DESC';
$result = mysql_query($query);
$item = mysql_fetch_array($result, MYSQL_ASSOC)
$data = array('id' => $item['id'], 'title' => $item['title'], 'date' => $item['date'], 'time' => "", 'poster' => $item['poster'], 'article' => $item['text'], 'comments' => $item['blah'], 'extra' => $item['moretext']);
mysql_close();
unset($sql);
unset($query);
unset($result);
unset($item);
$smarty->assign('news', $data);
// Get comments.
$sql = $dbfunctions->sqlconnect();
$query = 'SELECT * FROM comments WHERE postid=' . $_GET['id'] . ' ORDER BY id DESC';
$result = mysql_query($query);
while ($item = mysql_fetch_array($result, MYSQL_ASSOC))
{
	$data2[$i] = array('date' => $item['date'], 'poster' => $item['poster'], 'comment' => $item['comment']);
	$i++;
}
mysql_close();
unset($sql);
unset($query);
unset($result);
unset($item);
$smarty->assign('comments', $data2);
?>