Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

17478 Posts in 4473 Topics by 1972 members

Archive

SilverStripe Forums » Archive » show query result

Our old forums are still available as a read-only archive.

Page: 1
Go to End
Author Topic: show query result 438 Views
  • ojalà
    avatar
    Community Member
    87 posts

    show query result Link to this post

    Hi!
    I have a big problem with my query. Can you hel me to show the result?
    I create a function in Page.php that contain my query and that return $result. then I copy $result uin my template but nothig happen. what is wrong?
    This is my code:

    function TakeValue(){
          $sqlQuery = new SQLQuery();
          $sqlQuery->select[] = array(
              'nome AS nome',
              'tipologia AS tipologia'
             
          );
          $sqlQuery->from[] = "
           RicercaPollSubmission
          ";
          $sqlQuery->where = "
           Tipologia(RicercaPollSubmission.tipologia) = 1
          ";
          
          // get the raw SQL
          $rawSQL = $sqlQuery->sql();
          
          // execute and return a Query-object
          $result = $sqlQuery->execute();
          
          //turn it into SilverStripe objects
          $result = new DataObjectSet();
          foreach($query as $row) {
          $result->push(new TakeValueDataObject($row));

          }
          return $result;
    }

    438 Views
Page: 1
Go to Top

Currently Online: Euphemismus

Welcome to our latest member: jonchamberlain

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

Comments on this website? Please give feedback.