Zikula: A Flexible Open Source Content Management System
home | forum | international support | contact us

Support Forum

Start ::  Extensions and Distributions Support ::  Modules ::  Troubleshooting pninit.php

Moderated by: Support Team

Bottom
Troubleshooting pninit.php

  • Link to this postingPosted: 10.02.2004, 21:04
    Profile Homepage
    rjg
    rank:
    Freshman 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?
  • Link to this postingPosted: 10.02.2004, 21:12
    Profile Homepage
    mhalbrook
    rank:
    Legend 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).
  • Link to this postingPosted: 10.02.2004, 21:22
    Profile Homepage
    rjg
    rank:
    Freshman 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?
  • Link to this postingPosted: 10.02.2004, 22:06
    Profile Homepage
    rjg
    rank:
    Freshman 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).
  • Link to this postingPosted: 10.02.2004, 22:12
    Profile Homepage
    mhalbrook
    rank:
    Legend Legend
    registered:
     October 2001
    Status:
    offline
    last visit:
    28.08.08
    Posts:
    6481
    Can you post just the $sql1= and $sql2= parts?
  • Link to this postingPosted: 10.02.2004, 23:48
    Profile Homepage
    s3aNPaul
    rank:
    Softmore 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:
    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 ?
  • Link to this postingPosted: 10.02.2004, 23:58
    Profile Homepage
    rjg
    rank:
    Freshman 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);
  • Link to this postingPosted: 11.02.2004, 00:10
    Profile Homepage
    mhalbrook
    rank:
    Legend Legend
    registered:
     October 2001
    Status:
    offline
    last visit:
    28.08.08
    Posts:
    6481
    s3aNPaul, Please ask on their forums, or open a seperate thread here. Don't hijack threads for your own questions.
  • Link to this postingPosted: 11.02.2004, 00:11
    Profile Homepage
    mhalbrook
    rank:
    Legend Legend
    registered:
     October 2001
    Status:
    offline
    last visit:
    28.08.08
    Posts:
    6481
    I don't think it's the problem, but make one of those $sql1 and the other $sql2.
  • Link to this postingPosted: 11.02.2004, 00:38
    Profile Homepage
    rjg
    rank:
    Freshman Freshman
    registered:
     February 2004
    Status:
    offline
    last visit:
    11.02.04
    Posts:
    8
    Changing $sql1 and $sql2 did not help.
  • Link to this postingPosted: 11.02.2004, 01:49
    Profile Homepage
    markwest
    rank:
    Moderator 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
  • Link to this postingPosted: 11.02.2004, 02:07
    Profile Homepage
    mhalbrook
    rank:
    Legend Legend
    registered:
     October 2001
    Status:
    offline
    last visit:
    28.08.08
    Posts:
    6481
    I keep forgetting about calling the file directly.
  • Link to this postingPosted: 11.02.2004, 02:37
    Profile Homepage
    rjg
    rank:
    Freshman Freshman
    registered:
     February 2004
    Status:
    offline
    last visit:
    11.02.04
    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!

Start ::  Extensions and Distributions Support ::  Modules ::  Troubleshooting pninit.php

Main Menu

Extensions Database

Documentation

Development

Login





 


 Log in Problems?
 New User? Sign Up!

Donate to Zikula