Hi Hamish,
Thanks for you patience. I understand that SS provides mechanisms that mean that you don't have to be an SQL expert. So far this is what I have tried.
function SayingOfDay() {
$sqlQuery = new SQLQuery();
$sqlQuery->select = array(
'Author',
'Saying'
);
$sqlQuery->from = "Sayings";
// $sqlQuery->having = "";
// $sqlQuery->orderby = "";
// $sqlQuery->limit = "";
// $sqlQuery->distinct = true;
// get the raw SQL
$rawSQL = $sqlQuery->sql();
// execute and return a Query-object
$result = $sqlQuery->execute();
return $result;
//return DataObject::get($result);
//return DataObject::get("Sayings");
}
When flushing the system it comes up with a lot of errors but down the bottom it reports
user_error(DATABASE ERROR: Couldn't run query: SELECT Name, Application FROM | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1,256)
line 431 of Database.php
Database->databaseError(Couldn't run query: SELECT Name, Application FROM | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1,256)
line 108 of MySQLDatabase.php
MySQLDatabase->query(SELECT Name, Application FROM ,256)
line 81 of DB.php
DB::query(SELECT Name, Application FROM )
line 157 of SQLQuery.php
SQLQuery->execute()
line 67 of Page.php
To me this indicates that for some reason I'm not specifying the table correctly. However this is the table that I have successfully used to display data on the page using the technique that you reference in the beginning of this topic.