Hi forum,
I'am developing a new module for the german red cross and currently stuck at getting my pninit.php to work.
The pninit.php works as far as it creates the necessary database table, but when I try to initialisize it via the administration I get a Blank Page. After that I try to reload the site and it shows me the administration panel and the modules list, with "You are not authorized to carry out this operation" above it.
Anyone can offer a hint?
Sorry for my poor english...
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 07:01 AM
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 06:41 AM
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 06:27 AM
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 01:29 AM
- mdee created topic »How to implement returnpage ?« 01:00 AM
- nestormateo responded to »Fillters in Clip« 24. May
- damon responded to »Can the Updated Version Check be Turned Off (Z 1.3)« 24. May
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
New Module - blank page after initialisation?
-
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 395
safroe
Hi forum,
I'am developing a new module for the german red cross and currently stuck at getting my pninit.php to work.
The pninit.php works as far as it creates the necessary database table, but when I try to initialisize it via the administration I get a Blank Page. After that I try to reload the site and it shows me the administration panel and the modules list, with "You are not authorized to carry out this operation" above it.
Anyone can offer a hint?
Sorry for my poor english...
the you are not authorized, is for security, you cant refresh it.
as far as the Blank Page, u should debug the script, to see how far it actually gets, and what variables are being passed -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Jul 07, 2005
- Posts: 6
I don't get it, maybe could take a look. The problem seems to be the verification whether the database table creation failed or not. A var_dump($dbconn->ErrorNo() gives me 0, the SQL-command is correct and works...
Code
<?php
function DRK_init() {
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$fahrzeugtable = $pntable['_drk_fv_fahrzeug'];
$fahrzeugcolumn = &$pntable['_drk_fv_fahrzeug_column'];
$sql = "CREATE TABLE $fahrzeugtable ( $fahrzeugcolumn[FahrzeugID] TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
$fahrzeugcolumn[FahrzeugKennzeichen] VARCHAR(12) NOT NULL DEFAULT '',
$fahrzeugcolumn[FahrzeugArt] VARCHAR(32) NOT NULL DEFAULT '',
$fahrzeugcolumn[FahrzeugEinheit] VARCHAR(32) NOT NULL DEFAULT '',
PRIMARY KEY(FahrzeugID) )";
$dbconn->Execute($sql);
if($dbconn->ErrorNo() != 0) {
pnSessionSetVar('errormsg', _CREATETABLEFAILED);
return false;
}
return true;
}
function DRK_delete() {
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$sql = "DROP TABLE $pntable[_drk_fv_fahrzeug]";
$dbconn->Execute($sql);
if($dbconn->ErrorNo() != 0) {
pnSessionSetVar('errormsg', _DROPTABLEFAILED);
return false;
}
return true;
}
?> -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Jul 07, 2005
- Posts: 6
A var_dump($dbconn->ErrorNo()); outputs "int(0)", I think that is not the same as $dbconn->ErrorNo() = 0 because int(0) is an empty value and $dbconn->ErrorNo() = 0 is an integer value with 0 in it? -
**unknown user**
- Rank: Senior
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 2330
Make sure there is no white-space or extra lines after the ?> ... this is a leading cause of white-screen errors in the init process, IMHO.
Maybe try these as your first 2 lines in the init function:
Code
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();
...overall, it looks like your function should work...I don't see anything throwing up a red flag, but my eyes are tired... -
**unknown user**
- Rank: Senior
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 2330
What was is that worked...adding the upgrade function...or changing up the $dbconn...?
The & doesn't give you the first array value...it gives you a reference to the database connection resource as a whole, if I understand it correctly. -
- Rank: Legend
- Registered: Dec 11, 2002
- Last visit: Oct 21, 2009
- Posts: 11674
Quote
The & doesn't give you the first array value...it gives you a reference to the database connection resource as a whole, if I understand it correctly.
Yes, you reference the object rather than creating a copy of it (which is what = does). This uses less memory, and also has some other applications, which I've used in the past and have now forgotten
--
itbegins.co.uk - Zikula Consulting
birtwistle.me.uk - Personal Blog
Please read the Support Guide
- Moderated by:
- Support
