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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

show query result

Go to End



Community Member, 87 Posts

25 November 2008 at 5:06am

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[] = "
$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;