Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 907227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:31:13+00:00 2026-05-15T16:31:13+00:00

I have an element that grabs data from mysql. Here is my working code:

  • 0

I have an element that grabs data from mysql. Here is my working code:

$this->requestAction('posts/index/sort:id/direction:desc');

I want to grab only posts between id 1 and 6. How can I run that query via requestAction? Some of scripts that I have tried are below. None is working:

$this->requestAction('posts/index/sort:id/direction:desc', array('id between ? and ?' => array('1,6')));

or

$this->requestAction('posts/index/sort:id/between:1,6/direction:desc');

You may see my project at http://bake.yemeklog.com/ I want this code for third column (Last 30 days faves)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:31:14+00:00Added an answer on May 15, 2026 at 4:31 pm

    If I was going to be calling it via requestAction (!) then I would write a custom method in my controller, then I’d probably pass the two id’s into that method as parameters.

    Then you can process the parameters and formulate your query.

    $this->Model->find('all', 'conditions' => array('id'=>array(1,2,3,4,5,6)));
    

    Not ideal by any means, but I’m not quite sure how else I would approach this kind of problem.

    If it’s static id’s then perhaps

    $this->Model->find('all', null, null, 'order' => 'id ASC LIMIT 0,6');
    

    ** Now I’m not sure if that would work as I haven’t tried it, but I often hacked little things like this into Cake with some success. So perhaps give it a try, be sure to set debug = 2 so you can see the query, or grab DebugKit from OhLo

    PS, Dont forget if you write requestAction methods, to check that $this->params['requested'] is true, so you know it come from a requestAction

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 492k
  • Answers 492k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Jillika, Here is a simple query for skewness and excess… May 16, 2026 at 10:28 am
  • Editorial Team
    Editorial Team added an answer use DefaultEventAttribute: <DefaultEvent("KeyUp")> Public Class MyButton May 16, 2026 at 10:28 am
  • Editorial Team
    Editorial Team added an answer If a User can have different ThreadId count and Id… May 16, 2026 at 10:28 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Here's the deal: I have an Android application that needs to call a web
I have some information in my database like 'author', 'book' etc., that are all
I have the following bit of code. I'm trying to dynamically add drop-down options
I have a bunch of links that I want to load dynamically within the
Hi I have a datagridview which binds XML manually. I wish to sort out
I created an h1 element that gets a class added to it and removed
I'm having trouble selecting the text inside a span element that resides in another
I have many, (15-20) different XML files that I need to load to VB.Net.
I have a quick question How many dojo filteringselects can I have on a
I have basic tables one and two. Let`s call them tbl1 and tbl2. tbl1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.