Hi guy!
I have a problem in print my query result in my template..
in Page.php I have a function ShowQueryResult taht take value from forms and put this data in my database table (X). Here I have a query that take, in te same table (X) all 'Name' record with a particular propriety. I execute query and I convert the result in silverstripe object. My problem is how to put this result to my resultPage.
This is my function:
function ShowQueryResult ($data, $form) {
$submission = new RicercaPollSubmission();
$form->saveInto($submission);
$submission->write();
$sqlQuery = new SQLQuery();
$sqlQuery->select = array(
'Name AS Name',
'PhotoID AS PhotoID'
);
$sqlQuery->from= "
DBtable
";
$sqlQuery->where = "
PhotoID(DBtable.PhotoID) = 35
";
$rawSQL = $sqlQuery->sql();
$result = $sqlQuery->execute();
$result = new DataObjectSet();
foreach($query as $row) {
$result->push(new ArrayData($row));
}
return $this->cusomise($result)->renderWith(array('SearchPage_results', 'Page'));
}
then in my SerchPage_result i put this:
<% if doRicerca %>
<ul>
<% control doRicerca %>
<li>
$result
</li>
<% end_control %>
</ul>
<% else %>
<p>Sorry, your search query did not return any results.</p>
<% end_if %>