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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

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

get element where ID is different of, basic problem :/


Go to End


3 Posts   1969 Views

Avatar
snaip

Community Member, 181 Posts

16 June 2009 at 1:28am

Edited: 16/06/2009 1:29am

hi

i want to get random element where it ID is different of:

    $doSet = DataObject::get(
    $callerClass = "PlWycieczkaPage",
    $filter = "ID != 17",
    $sort = "RAND()",
    $join = "",
    $limit = 3 
    );
   return $doSet;

but i get:

Website Error
There has been an error
The website server has not been able to respond to your request.

Avatar
snaip

Community Member, 181 Posts

16 June 2009 at 10:28am

no idea ?
i dont believe that i cant do negation in SQL

Avatar
Willr

Forum Moderator, 5523 Posts

16 June 2009 at 5:18pm

Thats the standard error message. Use devmode to enable full debug / error messages

DataObject::get("PlWycieczkaPage", "`PlWycieczkaPage`.ID != '17'","RAND()",3);