Troubleshooting pninit.php  Bottom

  • 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?
  • 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
  • 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?
  • 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).
  • Can you post just the $sql1= and $sql2= parts?

    --
    Home Page | Find on Facebook | Follow on Twitter
  • 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 ?
  • 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);
  • 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
  • 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
  • Changing $sql1 and $sql2 did not help.
  • 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.
  • I keep forgetting about calling the file directly.

    --
    Home Page | Find on Facebook | Follow on Twitter
  • 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!

This list is based on users active over the last 60 minutes.