Newbie Question - Looping Over mySQL Result Sets
| From: | Roy | Date: | Sun, 23 Dec 2001 08:56:48 +0000 |
| Subject: | Newbie Question - Looping Over mySQL Result Sets | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-2376@lists.php.net to get a copy of this message | ||
Okay, I'm a newbie to Smarty. I've read over the docs, and I'm trying to do some basic, initial things to get my feet wet with it. First off, I'm trying to loop over a mySQL result set.
Am I correct in assuming that I can no longer just loop over the result set, and instead I'll need to store the results in a multi-dimensional array? Here's the typical existing code I have after doing a database query...
while ($row = mysql_fetch_array($sql_result)) {
$KeyID = $row["KeyID"];
$PostDate = $row["PostDate"];
$TextBlurb = $row["TextBlurb"];
echo "$KeyID - <b>$PostDate</b><br>$TextBlurb</font><p>";
}
So, I'll need to store this into some sort of array now? Can someone show me some code (both the PHP and Template)?
Thanks,
Roy