Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 2
FIX for “SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)”
 
curlyc
Jr. Member
 
Total Posts:  8
Joined:  2009-05-27
 

Hi,
This is issue is happening to me in the latest version of Magento, is this fix still relevant or is something newer required?

Thanks a lot

 
Magento Community Magento Community
Magento Community
Magento Community
 
Script Kiddi3
Jr. Member
 
Total Posts:  18
Joined:  2010-05-24
Rawalpindi
 

Same Issue on my side. I am linking one product with multiple categories and em getting the same error

SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)

I dont know why it is showing like this, there might be a connection of this error with the design layout, but it doesnt worked when i changed the design layout........ Plz help!

Regards,
Tauseef

 
Magento Community Magento Community
Magento Community
Magento Community
 
Script Kiddi3
Jr. Member
 
Total Posts:  18
Joined:  2010-05-24
Rawalpindi
 

If anyone is displaying one product under several categories then he must replace view.phtml with the default one or you must see the code you have written in view.phtml
Guys The Issue is in this file thats why i was getting the error…

app/design/frontend/default/"Your Theme"/template/catalog/product/view.phtml

Just place the default view.phtml file on the above location.

The error will be resolved.

Regards,
Tauseef

 
Magento Community Magento Community
Magento Community
Magento Community
 
wow_newmedia
Jr. Member
 
Total Posts:  12
Joined:  2010-04-21
 

Hello, tried putting the default view.phtml but still get the same error.

Anybody tried on 1.4.0.1

Thank you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 

Print a debug back trace for this error to find it’s root case.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sirvash Sharma
Jr. Member
 
Avatar
Total Posts:  15
Joined:  2009-08-31
 

Hi All,

The problem is due to blank array passed in execute function that\’s why through the exception. update the attached file within library directory.

Dir: lib/Zend/Db/Statement.php

Regards,

Sirvash Sharma

File Attachments
Statement.php  (File Size: 14KB - Downloads: 158)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Sirvash Sharma
Jr. Member
 
Avatar
Total Posts:  15
Joined:  2009-08-31
 

Hi All,

The problem is due to blank array passed in execute function that\\\\\\\’s why through the exception. update the attached file within library directory.

Dir: lib\\\\\\\\Zend\\\\\\\\Db\\\\\\\\Statement.php

File Attachments
Statement.php  (File Size: 14KB - Downloads: 258)
 
Magento Community Magento Community
Magento Community
Magento Community
 
sampal
Jr. Member
 
Total Posts:  1
Joined:  2011-05-15
 

Thank you very much.But i am facing a problem with this:

Error:[21000]: Cardinality violation:1222The used SELECT statements have a different number of colum.
please help me to solve this problem,as soon as possible.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jamal.nasir
Jr. Member
 
Total Posts:  16
Joined:  2009-03-26
 
Sirvash Sharma - 04 August 2011 09:01 PM

Hi All,

The problem is due to blank array passed in execute function that\\\\\\\’s why through the exception. update the attached file within library directory.

Dir: lib\\\\\\\\Zend\\\\\\\\Db\\\\\\\\Statement.php

Thanks smile. It worked for me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kevando
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2011-06-27
 

Replacing the statement.php Fixed the issue for me as well! Thanks

I am running Magento ver. 1.9.1.0

 
Magento Community Magento Community
Magento Community
Magento Community
 
pradeep_kumar67
Sr. Member
 
Avatar
Total Posts:  160
Joined:  2010-06-24
Bangalore
 
Script Kiddi3 - 21 July 2010 01:20 AM

Same Issue on my side. I am linking one product with multiple categories and em getting the same error

SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)

I dont know why it is showing like this, there might be a connection of this error with the design layout, but it doesnt worked when i changed the design layout........ Plz help!

Regards,
Tauseef

Hi,

if you come across SQL ERROR “Cardinality violation: 1241 Operand should contain 1 column” because of 2 reason
1.  you are trying to call the column of table which is not exists
or
2. if the issue come for configurable product then you may selected same attribute product more then 2 times

that is if you created config product in base of size as config attribute and you select a more then 1 product with same size

if you mapped more then 1 product with same attribute value (ex:- size no. 10 where size is config attribute ) as Associated Product
then you will come across SQL ERROR “Cardinality violation: 1241 Operand should contain 1 column”

this will happen while importing through some script or magmi when data sheet is in-correct

so just go to that config product and un-select that duplicate Associated Product

Enjoy grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
john_bridger
Jr. Member
 
Total Posts:  1
Joined:  2012-10-28
 
Sirvash Sharma - 04 August 2011 08:58 PM

Hi All,

The problem is due to blank array passed in execute function that\’s why through the exception. update the attached file within library directory.

Dir: lib/Zend/Db/Statement.php

Regards,

Sirvash Sharma

Worked! Thank you Sirvash

Magento 1.7 error was happening whenever displaying a config product on the front end that had more than 1 option, eg a shirt with selectable size and colour

It is odd that the error just started happening, site has been fine for months!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Hadifarnoud
Sr. Member
 
Total Posts:  210
Joined:  2007-10-07
Guildford, Surrey, UK
 
Sirvash Sharma - 04 August 2011 08:58 PM

Hi All,

The problem is due to blank array passed in execute function that\’s why through the exception. update the attached file within library directory.

Dir: lib/Zend/Db/Statement.php

Regards,

Sirvash Sharma

please report this bug with your solution.
http://www.magentocommerce.com/bug-tracking

thank you smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
shalureshma123
Jr. Member
 
Total Posts:  4
Joined:  2012-04-16
 

Hi All,

If you pass array you will get this issue SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)

Here is the sample,

<?php $getcatid=$_item->getProduct()->getCategoryIds();
?>
<?php $geturl=Mage::getModel(\\\"catalog/category\\\")->load($getcatid;)->getUrl();
echo $geturl;
?>

I have tried to get the url by loading category id $getcatid, But i got issue, Later i can understand
the value of $getcatid=Array
So $geturl would like $geturl=Mage::getModel(\\\"catalog/category\\\")->load(Array)->getUrl();

Hope it will helpful grin

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2