Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » print db array in my template

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

Page: 1
Go to End
Author Topic: 1131 Views
  • bebabeba
    Community Member
    192 Posts

    print db array in my template Link to this post

    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..

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.