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 8817173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:46:54+00:00 2026-06-14T04:46:54+00:00

Simply said, I am trying to do this: $widgetsUsed->updateAll(array( ‘position’=>’- 1′ ), position >

  • 0

Simply said, I am trying to do this:

$widgetsUsed->updateAll(array(
                'position'=>'- 1'
            ),
            "position > {$position} AND sidebar_id = {$sidebar_id}"
         );

Does anyone have a clue if this works, or give some other suggestions how to achieve this?

Having a hard time to debug this since I can’t exactly make up what values are chaning when in my database. So I was hoping anyone here would directly know how to do this.

Thanks in advance

  • 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-06-14T04:46:56+00:00Added an answer on June 14, 2026 at 4:46 am

    You can try as below

    Yii::app()->db->commandBuilder->createUpdateCounterCommand('{{myTable}}', array(
      'position' => 1, // -1 for decrementing
      new CDbCriteria(array(
            "condition" => "position > :pos AND sidebar_id = :id",
            "params" => array(
                "pos"=>$position, 
                "id"=>$sidebar_id
            )
        ))
    ));
    

    If you have higher version of Yii, then you can use http://www.yiiframework.com/wiki/282/using-counters-with-activerecord/

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

Sidebar

Related Questions

I'm trying to dynamically add results to this display and I simply want to
Trying to get this form to validate email using the function the professor said
Simply, I'm just looking to get a list of connected remote disks. I have
Simply put I want what http://www.reddit.com/ and http://news.ycombinator.com/ have to the left of every
Simply put, I'm getting this error in the Product Admin of Magento after adding
No, this isn't about the mistake everyone makes of passing locals. I'm just trying
I'm trying to create a webpage to merge vendors in our database and have
I'm trying to svn checkout into my public_html folder, but I get this error:
I have some code where I am trying to use variables in a tabpage.
Simply put, I am trying to create a custom logger for visitors to a

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.