Hi
I am trying to retrieve an object that has a category the same as the page title. I am using the code
$MFoptions = DataObject::get_one("MFCategory", 'MFTitle='.$this->title);
but this errors with the message [User Error] Couldn't run query: SELECT `MFCategory`.*, `MFCategory`.ID, if(`MFCategory`.ClassName,`MFCategory`.ClassName,'MFCategory') AS RecordClassName FROM `MFCategory` WHERE (MFTitle=counselling) LIMIT 1 Unknown column 'counselling' in 'where clause'
So I get it is looking for a column called counselling cause it is not in '' but when I put it in '' ie $MFoptions = DataObject::get_one("MFCategory", 'MFTitle='.'$this->title');
it interprets the $this->title as a literal string. Please help, I know this must be simple to fix but I just can't work it out.
Thanks as always
MM