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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:21:49+00:00 2026-06-11T21:21:49+00:00

Can anybody help me out, while my solution does not seem to work: $this->db->where(‘stock

  • 0

Can anybody help me out, while my solution does not seem to work:

$this->db->where('stock <=','stock_min');
$res = $this->db->get("products")->result();

You see I want to compare the field ‘stock’ to be less than or equal to ‘stock_min’…

Someone?

As requested the table-structure:

    CREATE TABLE IF NOT EXISTS `products` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sub_of` int(11) DEFAULT NULL,
  `category` int(45) NOT NULL DEFAULT '0',
  `name` varchar(45) NOT NULL DEFAULT '',
  `slug` varchar(250) NOT NULL,
  `number` varchar(45) DEFAULT NULL,
  `description` text NOT NULL,
  `value` decimal(5,0) NOT NULL DEFAULT '0',
  `value_discount` varchar(100) DEFAULT NULL,
  `yell` varchar(100) DEFAULT NULL,
  `display_price` tinyint(1) DEFAULT '0',
  `stock` int(11) NOT NULL DEFAULT '0',
  `stock_min` int(11) NOT NULL DEFAULT '1',
  `warned` tinyint(2) NOT NULL DEFAULT '0',
  `relation` varchar(350) DEFAULT NULL,
  `supplier` varchar(150) DEFAULT NULL,
  `price_in` decimal(10,2) DEFAULT '0.00',
  `price_out` decimal(10,2) DEFAULT '0.00',
  `price_out_btw` decimal(10,2) DEFAULT '0.00',
  `active` smallint(6) DEFAULT '0',
  `display_from` date NOT NULL DEFAULT '0000-00-00',
  `display_till` date NOT NULL DEFAULT '0000-00-00',
  `seen` int(11) NOT NULL DEFAULT '0',
  `info_requested` int(11) NOT NULL DEFAULT '0',
  `inserted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=322 ;
  • 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-11T21:21:50+00:00Added an answer on June 11, 2026 at 9:21 pm

    Try this:

    $this->db->where('stock <= stock_min');
    

    In your code the ‘min_stock’ is interpreted as the string ‘min_stock’ not the column. In the future when you have this kind of issues you can call $this->db->last_query(); to see the exact query that is ran against the DB.

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

Sidebar

Related Questions

I am not that expert in SSIS. Can anybody help me out on my
Can anybody help me in finding out how to verify that _tmkdir succeeded. For
can anybody help me understand how Honda achieved this effect: http://testdays.hondamoto.ch/ I mean the
Can anybody help me with this simple code?? #include <iostream> using namespace std; void
Can anybody help me out? I would like to store a hex colorPicker value
Can any body help me out how to clear the items in the list
Can anybody help me how can I invoke a JSP page from a Servlet
Can anybody help how to setup a automatic backup of mysql database and then
can anybody help me how to nice integrate doctrine 2.0 into ZF 1.10? I
Can anybody help me writing a regular expression to replace these characters with 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.