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

  • Home
  • SEARCH
  • 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 6621643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:17:37+00:00 2026-05-25T21:17:37+00:00

Recently I’ve imported a new database to develop on my local machine, however it

  • 0

Recently I’ve imported a new database to develop on my local machine, however it doesn’t work: the ENUM column only works when the variable is sent without quotation marks. Here’s an example:

mysql.local>select count(*) from psh_products where active = 1;
+----------+
| count(*) |
+----------+
|    72782 |
+----------+
1 row in set (0.04 sec)

mysql.local>select count(*) from psh_products where active = '1';
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

In case you’re wondering about the table structure:

CREATE TABLE `psh_products` (
  `productID` int(12) unsigned NOT NULL AUTO_INCREMENT,
  `catID` int(2) unsigned NOT NULL,
  `main_sku` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `sku` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `shortsku` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `upc` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `description` text COLLATE utf8_unicode_ci NOT NULL,
  `quantity` int(2) unsigned NOT NULL,
  `buy_now` decimal(11,2) NOT NULL,
  `seller_cost` decimal(11,2) NOT NULL,
  `cdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `codedir` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  `code` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `basic_colorID` int(2) unsigned NOT NULL,
  `manu_colorID` int(2) unsigned NOT NULL,
  `brandID` int(2) unsigned NOT NULL,
  `matID` int(2) unsigned NOT NULL,
  `sizeID` int(2) unsigned NOT NULL,
  `size_sID` int(2) unsigned NOT NULL,
  `styleID` int(2) unsigned NOT NULL,
  `featID` int(2) unsigned NOT NULL,
  `occID` int(2) unsigned NOT NULL,
  `widthID` int(2) unsigned NOT NULL,
  `width_sID` int(2) unsigned NOT NULL,
  `genderID` int(2) unsigned NOT NULL,
  `gender_sID` int(2) unsigned NOT NULL,
  `hits` int(2) unsigned NOT NULL,
  `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `tags` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `tmp_img` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `imgact` enum('again','flip','resize','moderated','badimg','badimgm','badimga') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'moderated',
  `status` enum('new','moderated') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'moderated',
  `quanflag` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `deleted` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  PRIMARY KEY (`productID`),
  KEY `idx_cid` (`catID`),
  KEY `idx_bid` (`brandID`),
  KEY `idx_act` (`active`),
  KEY `idx_act_hits` (`active`,`hits`),
  KEY `idx_wid` (`widthID`),
  KEY `idx_sid` (`sizeID`),
  KEY `idx_styleid` (`styleID`),
  KEY `idx_sku` (`sku`),
  KEY `idx_msku` (`main_sku`),
  KEY `idx_matid` (`matID`),
  KEY `idx_cid_mstyleid` (`catID`,`featID`),
  KEY `idx_shortsku` (`shortsku`),
  KEY `idx_quant` (`quantity`),
  KEY `idx_quanflag` (`quanflag`),
  KEY `idx_hits` (`hits`),
  KEY `idx_act_qua_cat` (`active`,`quantity`,`catID`),
  KEY `idx_act_qua_cat_sho` (`active`,`quantity`,`catID`,`shortsku`),
  KEY `idx_bcolor_id` (`basic_colorID`),
  KEY `idx_mcolor_id` (`manu_colorID`),
  KEY `idx_cdate` (`cdate`),
  KEY `idx_deleted` (`deleted`),
  KEY `occID` (`occID`),
  KEY `idx_fid` (`featID`),
  KEY `width_sID` (`width_sID`,`genderID`,`gender_sID`)
) ENGINE=InnoDB AUTO_INCREMENT=72790 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

Any ideas are welcome!

  • 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-25T21:17:37+00:00Added an answer on May 25, 2026 at 9:17 pm

    Note that when you use a numerical value in a query against an enum data type as in your first query, the numerical value is treated as an index, not as one of the enumerated values.

    So, querying

    select count(*) from psh_products where active = 1;
    

    is really equivalent to

    select count(*) from psh_products where active = '0';
    

    since ‘0’ is the first item (index 1) in the enumeration.

    Because of this confusion, the documentation explicilty states “we strongly recommend that you do not use numbers as enumeration values.”

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

Sidebar

Related Questions

recently I started a small Django project that I developed on a local machine
Recently Jeff has posted regarding his trouble with database deadlocks related to reading. Multiversion
Recently I had to develop a SharePoint workflow, and I found the experience quite
Recently we got a new server at the office purely for testing purposes. It
Recently I've been trying to debug some low-level work and I could not find
Recently i've found myself writing a lot of methods with what i can only
Recently we started working with Database project in Visual Studio 2010. I have added
Recently, when I tried to show the results of my work (some Flex app)
Recently finished reading Eric Evans Domain Driven Design (very informative, very enjoyable) however come
Recently I have been working with a SQL Server database and I was trying

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.