.. still learning.. smarty, mysql results array
| From: | Blue Presley | Date: | Fri, 19 Apr 2002 18:09:34 +0000 |
| Subject: | .. still learning.. smarty, mysql results array | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-3817@lists.php.net to get a copy of this message | ||
here is a while statement that is pulling results out of the database and placing them into an
array:
while($row = mysql_fetch_array($result))
{
array_push ($myarray, array(
'adid' =>$row["adId"],
'adtitle' =>$row["adtitle"],
'companyname' =>$row["compname"],
'location' =>$row["location"] ));
}
$smarty->assign('idscats', $mayarray);
Here is the template that works with the script:
{section name=searchresults loop=$idscats}
<tr>
<td width="25%" height="30">{$postdate[searchresults]}</td>
<td width="25%" >{$adtitle[searchresults]}</td>
<td width="25%" >{$location[searchresults]}</td>
<td width="25%" >{$companyname[searchresults]}</td>
</tr>
{/section}
as you can see, I'm trying to use {section} to loop through and add rows to a table until all
the array elements have been displayed. However, I'm not getting the results I want, and
don't know why. I keep getting a blank page. How do I make smarty interact with my script to
pull out and display these values?
blue