Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

print db array in my template


Go to End


2363 Views

Avatar
bebabeba

Community Member, 193 Posts

19 December 2008 at 3:28am

hi!
I create a serch form: if the user write a word in the serch area, silverstripe look for in the db if that name exixt.
If name exixts I memorize in an array the name plus the other records in the database.
I can't print this array in my template.

The function that create the arry return an array:

$records = DB::query('select nome, tipologia from ricercapollsubmission where tipologia='.$form_value['Tipo'].' limit 0,10 ');

while ($rec=$records->nextRecord())
{
$nuovo_rec = $rec;
}
return $nuovo_rec;

I need to print in my template my result.

<? if(!empty($nuovo_rec))
{
?>
<div><? print_r($nuovo_rec); ?></div>
<?
}
?>

but I can't print my data in template..