Here's the pntables.php code
Code
function $PostChef_pntables()
{
// Initialise table array
$pntable = array();
// Name for Categories database entities
$PostChef = pnConfigGetVar('prefix') . '_postchef_categories';
// Table name
$pntable['postchefcategories'] = $PostChef;
// Column names
$pntable['postchef_categories'] = array('catid' => $PostChef . '.catid',
'short' => $PostChef . '.short',
'long' => $PostChef . '.long');
// Return the table information
return $pntable;
}
{
// Initialise table array
$pntable = array();
// Name for Categories database entities
$PostChef = pnConfigGetVar('prefix') . '_postchef_categories';
// Table name
$pntable['postchefcategories'] = $PostChef;
// Column names
$pntable['postchef_categories'] = array('catid' => $PostChef . '.catid',
'short' => $PostChef . '.short',
'long' => $PostChef . '.long');
// Return the table information
return $pntable;
}
And the pninit.php init function
Code
function PostChef_init() {
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$postchefcategoriestable = $pntable['postchefcategories'];
$postchefcategoriescolumn = &$pntable['postchef_categories'];
$sql = "CREATE TABLE $postchefcategoriestable (
$postchefcategoriescolumn[catid] tinyint(3) NOT NULL auto_increment,
$postchefcategoriescolumn[short] varchar(32) NOT NULL default '',
$postchefcategoriescolumn[long] longtext NOT NULL default '',
PRIMARY KEY (catid))";
$dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
pnSessionSetVar('errormsg', $sql);
return false;
}
}
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$postchefcategoriestable = $pntable['postchefcategories'];
$postchefcategoriescolumn = &$pntable['postchef_categories'];
$sql = "CREATE TABLE $postchefcategoriestable (
$postchefcategoriescolumn[catid] tinyint(3) NOT NULL auto_increment,
$postchefcategoriescolumn[short] varchar(32) NOT NULL default '',
$postchefcategoriescolumn[long] longtext NOT NULL default '',
PRIMARY KEY (catid))";
$dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
pnSessionSetVar('errormsg', $sql);
return false;
}
}
I modified the error trap to give me the $SQL statement as you can see, and it's not getting any of the variables.
Right now the module is striped down to just these two files, no point continuing until I can create the database.
