Take a look at this problem
| From: | Vladimir Kravtsov | Date: | Fri, 03 Jan 2003 03:34:06 +0000 |
| Subject: | Take a look at this problem | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6996@lists.php.net to get a copy of this message | ||
I have the following code:
<?php
require ('common.php'); //Includes all of the pre-written functions
connectdb(); //Connects to the database
//This is the Smarty template system
define('SMARTY_DIR','c:/inetpub/wwwroot/newphp/x-news/');
require(SMARTY_DIR.'Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = "c:/inetpub/wwwroot/newphp/x-news/templates/";
$smarty->compile_dir = "c:/inetpub/wwwroot/newphp/x-news/templates_c/";
$query = mysql_query("SELECT postid, subject, body, authoremail, authorname, date, time FROM
posts ORDER BY postid ASC");
while ($row = mysql_fetch_array($query)) {//Selects all of the posts
//Assign the information to the template
$smarty->assign('newsbox',
Array('postid'=>$row['postid'], 'subject' =>
$row['subject'], 'body' =>$row['body'], 'authoremail'
=>$row['authoremail'],'date' =>$row['date'], 'time'
=>$row['time'], 'authorname' => $row['authorname'] ));
}
$smarty->display('index.tpl');
//Shows the page
?>
This only prints the first entry in my databse (my template just prints things like newsbox.postid.
How can I make this print all of the entries?