I am building a custom module based on the Template module. My module was working fine with one database being created in pninit.php, however, I since then have been trying to add a second database and continue to get the 'Table Creation Failed' error. I have been through my code many times and just cannot see the error.
Is there any way to get a more detail error description for debugging?
- jmvaughn created topic »TagIt 3.0 for Zikula« 09:34 AM
- jmvaughn responded to »Shoutit for zikula 1.3?« 09:31 AM
- mdee responded to »Different page content under one template (tpl file) based on URL« 07:17 AM
- Guite responded to »Remove contents of nuke_sc_anticracker from Database« 01:30 AM
- espaan responded to »Categories disappear when editing ...« 08. Feb
- eledril responded to »How decrease zikula cpu usage« 08. Feb
- jmvaughn responded to »PN 0.764 to Zikula 1.1.2 (migration) Internal Server Error« 08. Feb
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Troubleshooting pninit.php
-
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: Jun 01, 2010
- Posts: 6840
Nope, that's why I use ModuleMaker to generate my init & tables files, too easy to overlook something.
That said, did you delete the first table (Database is a collection of tables,tables are what you are using).
--
Home Page | Find on Facebook | Follow on Twitter
-
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Feb 10, 2004
- Posts: 8
Right, tables not databases...I've got way too many things floating around in my head!
I have deleted the first table and I also add code to remove the first table when the second fails to create. I never looked at ModuleMaker. Do you have a link? -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Feb 10, 2004
- Posts: 8
This is interesting...
I found ModuleMaker (thanks mhalbrook) and created a module based on my two existing tables. Without touching the generated module, I tried to initialize it and it still fails on the second table (just shows the same error in a different language). -
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: Jun 01, 2010
- Posts: 6840
-
**unknown user**
- Rank: Freshman
- Registered: Mar 16, 2002
- Last visit: Jun 26, 2009
- Posts: 58
i have a problem with pninit.php , i am trying to install PNPhpBB , i did wat is in the help ont their site but when i press initialise i have the next error:
Code
Fatal error: Call to undefined function: getpnlanguage() in /usr/local/www/data-dist/go/postnuke/modules/PNphpBB2/pninit.php on line 144
Wat should i do ? -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Feb 10, 2004
- Posts: 8
This is a classic Order Header -> Order Detail structure.
$SQL = "CREATE TABLE $headertable (
$headercolumn [order_id] int(10) NOT NULL auto_increment,
$headercolumn [order_no] varchar(8) NOT NULL default '',
$headercolumn [rep_code] int(5) NOT NULL default 0,
$headercolumn [cus_no] int(12) NOT NULL default 0,
$headercolumn [po_no] int(25) NOT NULL default 0,
$headercolumn [ord_dt] date NOT NULL default '0000-00-00',
$headercolumn [billing_dt] date NOT NULL default '0000-00-00',
$headercolumn [shipping_dt] date NOT NULL default '0000-00-00',
$headercolumn [ship_via] varchar(5) NOT NULL default '',
$headercolumn [tracking_no] varchar(50) NOT NULL default '',
$headercolumn [status] varchar(5) NOT NULL default '',
PRIMARY KEY(order_id))";
$dbconn->Execute($SQL);
$SQL = "CREATE TABLE $detailtable (
$detailcolumn [order_id] int(10) NOT NULL default '0',
$detailcolumn [line_no] smallint(6) NOT NULL default '0',
$detailcolumn [item_no] varchar(15) NOT NULL default '',
$detailcolumn [item_desc_1] varchar(30) NOT NULL default '',
$detailcolumn [qty_ordered] decimal(10,0) NOT NULL default '0',
$detailcolumn [unit_price] decimal(10,2) NOT NULL default '0.00'
)";
$dbconn->Execute($SQL); -
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: Jun 01, 2010
- Posts: 6840
s3aNPaul, Please ask on their forums, or open a seperate thread here. Don't hijack threads for your own questions.
--
Home Page | Find on Facebook | Follow on Twitter
-
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: Jun 01, 2010
- Posts: 6840
I don't think it's the problem, but make one of those $sql1 and the other $sql2.
--
Home Page | Find on Facebook | Follow on Twitter
-
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
Two tricks.
1. Call pninit.php directly in the browser to check for parse errors in the code. i.e. http://www.yoursite.com/modules/yourmodule/pninit.php
2. Add an echo $SQL after creating the variable (both $sql1 and $sql2 in your case), add a die; statement after the second echo. This will echo the actual SQL statement out to the browser. Copy and paste these into phpMyAdmin and see if this gives you any extra diagnostics on the formation of SQL.
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: Jun 01, 2010
- Posts: 6840
I keep forgetting about calling the file directly.
--
Home Page | Find on Facebook | Follow on Twitter
-
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Feb 10, 2004
- Posts: 8
Thanks for the tricks...I got everthing working.
I had spaces after $detailcolumn and before [field_name]. Coding would be boring without little syntax errors...
Thanks to both of you!
- Moderated by:
- Support
