All pastes #252665 Raw Edit

Stuff

public text v1 · immutable
#252665 ·published 2006-11-19 20:41 UTC
rendered paste body
<?php
error_reporting(E_ALL & ~E_NOTICE);

define('THIS_SCRIPT', 'showpoem');

require_once './global.php';

if(empty($_REQUEST['poemid']))
{
	/* Send user to a different page */
	header('Location: index.php');
}

$sql = "SELECT * FROM poems AS p, users AS u WHERE p.user_id = u.user_id AND p.poem_id = ?";
$sth = $db->prepare($sql, array('integer'), MDB2_PREPARE_RESULT);
$data = array($_REQUEST['poemid']);
$results = $sth->execute($data);
if(!MDB2::isError($results))
{
	/* Display Poem */
	$rows = $results->fetchRow(MDB2_FETCHMODE_ASSOC);
	$smarty->assign('poem_title', $rows['title']);
	$smarty->assign('poem_id', $rows['poem_id']);
	$smarty->assign('poem_description', $rows['description']);
	$smarty->assign('poem_body', $rows['body']);
	$smarty->assign('poem_added', $rows['added']);
	$smarty->assign('poem_user_id', $rows['user_id']);
	$smarty->assign('poem_user_email', $rows['email']);
	$smarty->display('showpoem.tpl');
}
else
{
	/* Error */
}
?>