Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Is it possible to use the
  • (EDIT, TO BAD i can't edit the title!.. ) Hi there, I've setup a tinyint (day) field in my team table. The field helps storing the day of the week. (just static, nothing to do with dates). Of course i could use mysql 's ENUM but that's the evil way. I want to do it clean. So is it possible to alternate the ORM query for selecting the day field?
    SELECT ELT(day, 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday') FROM team;
    

    If day = 5, this query returns 'friday' If day = 7, this query returns 'sunday'
    If it isn't possible, then what's the best practise in such situation. I bet a lot of people have 'tinyint' fields for little properties. Using the ELT function it is easy to translate...
  • Not through ORM, as that will only retrieve records as-is. You'll have to use a DB query for this.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion