Zen Cart Logo
Forums / Contribution-Writing Guidelines / Define new db tables

Define new db tables

Locked

Views: 3,441

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
21 Nov 2008, 11:20 AM
#1
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

Define new db tables

I'm making some improvements to the Dangling Carrot mod as it overwrites several core files at the moment. The problem i'm faced with is that i added a declare to the original database_tables file. I now want to move this to includes/extra_datafiles, which is where i think it is supposed to be. I put it into this folder with a name of free_gift_database_tables but it does not seem to get read when the cart is loaded as i get an error stating Table 'zentest.table_carrot' doesn't exist.

Am i putting this in the right place, or does it need to be declared somewhere before it will function.

Thanks.

Steve

22 Nov 2008, 7:29 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Define new db tables

Try adding the .php extension to the file?
/includes/extra_datafiles/free_gift_database_tables**.php**

23 Nov 2008, 6:40 PM
#3
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

Re: Define new db tables

Dr Byte,

I'm not a total novice...it is saved with the .php extension :P

I've not found a solution to this, so if anyone has any more ideas, please share them.

And, can anyone explain why db tables are delared in includes, rather than admin/includes?

Regards
Steve

23 Nov 2008, 8:11 PM
#4
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Location:
Washington, DC
Posts:
775
Plugin Contributions:
1

Re: Define new db tables

strelitzia:

Dr Byte,

And, can anyone explain why db tables are delared in includes, rather than admin/includes?

Regards
Steve

/admin/includes/extra_datafiles/free_gift_database_tables.php

// example
define('FREE_GIFT', DB_PREFIX . 'free_gifts');

I am not familiar with this mod but if it only needs admin thats where the table define file goes.

23 Nov 2008, 9:39 PM
#5
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Define new db tables

Looking at the error message you posted it looks like the database table is defined correctly, but the table does not exist.

The definition tells the php script what the table name is, it does not create the table.

25 Nov 2008, 12:12 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Define new db tables

strelitzia:

Dr Byte,

I'm not a total novice...it is saved with the .php extension :P

I've not found a solution to this, so if anyone has any more ideas, please share them.

And, can anyone explain why db tables are delared in includes, rather than admin/includes?

Regards
Steve

Your original message didn't make any mention of "admin".

If your admin area needs access to the table, you'll have to add the define for the table name in the admin side as well, as skipwater pointed out.