cora cp users

N e s s

New member
Messages
202
Points
0
Age
33
how to fix this error? 

A Database Error OccurredError Number: 1054

Unknown column 'item_db.type' in 'where clause'

SELECT * FROM ((SELECT * FROM (`tcp_shop`) JOIN `item_db2` ON `item_db2`.`id`=`tcp_shop`.`item_id` WHERE `item_db.type`=5) UNION (SELECT * FROM (`tcp_shop`) JOIN `item_db` ON `item_db`.`id`=`tcp_shop`.`item_id` WHERE `item_db.type`=5)) a ORDER BY `name_japanese` asc LIMIT 0, 10

Filename: /home/brynhild/application/models/mshop.php

Line Number: 60

i got this error when i click consumable, weapon, costumes, pet, cards, and misc category in cash shop
default_sad.png
help me for those who are using cora cp
default_sad.png


 
Hi. The problem here is that in the shop controller, the `type` fields are prefixed with the `item_db` table name while in the model it's also prefixed with whatever db you choose. So if you are using item_db, it would add an item_db string string in the field name which will result into `item_db`.`item_db.type` thus creating an error in the sql statement.
 
You can fix this by editing line 24-51 of the application/controllers/shop.php file. In those lines you'll find this piece of code:
 

if(isset($_GET['cat'])) { switch($_GET['cat']) { case 'consume': $cond = array('index'=>'item_db.type','val'=>array(0,2,11,18)); break; case 'head': $cond = array('index'=>'equip_locations','val'=>array(1,256,257,512,513,768,769)); break; case 'weapon': $cond = array('index'=>'item_db.type','val'=>array(5)); break; case 'shield': $cond = array('index'=>'equip_locations','val'=>array(32)); break; case 'armor': $cond = array('index'=>'equip_locations','val'=>array(16)); break; case 'robe': $cond = array('index'=>'equip_locations','val'=>array(4)); break; case 'shoes': $cond = array('index'=>'equip_locations','val'=>array(64)); break; case 'accessories': $cond = array('index'=>'equip_locations','val'=>array(8,128,136)); break; case 'pets': $cond = array('index'=>'item_db.type','val'=>array(7,8)); break; case 'cards': $cond = array('index'=>'item_db.type','val'=>array(6)); break; case 'costumes': $cond = array('index'=>'equip_locations','val'=>array(1024,2048,3072,4096,5120,6144,7168,8192)); case 'misc': $cond = array('index'=>'item_db.type','val'=>array(3,10)); break; } }
For each case where the 'index' is `item_db.type`, remove the item_db so you'll only be left with `type`. Unfortunately there's no official patch for this, so a fix for now will have to be done like this.

On the good note, we have already restarted development for the second phase of CORA's beta.

 
Back
Top