Start ::
Extensions and Distributions Support ::
Modules ::
Troubleshooting pninit.php
Moderated by: Support Team
-
- rank:
-
Freshman
- registered:
- February 2004
- Status:
- offline
- last visit:
- 11.02.04
- Posts:
- 8
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? -
- rank:
-
Legend
- registered:
- October 2001
- Status:
- offline
- last visit:
- 28.08.08
- Posts:
- 6481
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). -
- rank:
-
Freshman
- registered:
- February 2004
- Status:
- offline
- last visit:
- 11.02.04
- 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? -
- rank:
-
Freshman
- registered:
- February 2004
- Status:
- offline
- last visit:
- 11.02.04
- 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:
-
Softmore
- registered:
- February 2004
- Status:
- offline
- last visit:
- 21.03.04
- Posts:
- 61
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:
Wat should i do ? -
- rank:
-
Freshman
- registered:
- February 2004
- Status:
- offline
- last visit:
- 11.02.04
- 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:
-
Moderator
- registered:
- March 2002
- Status:
- offline
- last visit:
- 26.08.08
- Posts:
- 7720
Two tricks.
1. Call pninit.php directly in the browser to check for parse errors in the code. i.e. http://www.yoursite.com/m.../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
Start ::
Extensions and Distributions Support ::
Modules ::
Troubleshooting pninit.php
