Thanks
Here is the code I am using, BTW: I am using Roadsend's SiteManager
<?php
class test extends SM_module {
/**
* configure the module. run before moduleThink
*/
function moduleConfig() {
$this->addInVar('status',0,'int');
$this->addInVar('idupdated',-1,'int');
$this->addDirective('tableBorder','1');
$this->addDirective('tableBgColor','#eeeeee');
$this->addDirective('tableCenter','1');
$this->addDirective('tableCellPadding','3');
// check for a proper connection
if (!isset($this->dbH)) {
SM_fatalErrorPage("this module requires a database connection, which wasn't present!");
}
} //module Config
/**
* this function contains the core functionality entry point for the module.
*/
function moduleThink() {
// get some global config'd vars
global $PHP_SELF, $SM_siteManager, $SM_siteName;
$cstat=0;
$SQL = "select * from test where approval!=3";
$rh = $this->dbH->simpleQuery($SQL);
if (DB::isError($rh)) {
SM_fatalErrorPage("error");
}
else
{
$myForm =& $this->newSmartForm();
// New smartform file upload
$myForm->addDirective("enctype","multipart/form-data");
$status = $this->getVar('status');
$idupdated = $this->getVar('idupdated');
while ($rr = $this->dbH->fetchRow($rh))
{
$rowid= $rr['idxNum'];
$fname= $rr['fileName'];
$cstat= $rr['approval'];
this->say("<td>".$fname."</td>");
switch ($cstat) {
case 0:
$cpstatus="unassigned";
break;
case 1:
$cpstatus="new";
break;
case 2:
$cpstatus="archived";
break;
case 3:
$cpstatus="deleted";
break;
} //end switch
$this->say("<td>$cpstatus</td>");
$this->say("<td>".$this->sessionH->hLink($PHP_SELF."?status=2&idupdated=$rowid","Archive")."</td>");
$this->say("<td>".$this->sessionH->hLink($PHP_SELF."?status=1&idupdated=$rowid","New")."</td> ");
$this->say("<td>".$this->sessionH->hLink($PHP_SELF."?status=3&idupdated=$rowid","Delete")."</td> </tr>\n");
} //end while
if (($myForm->dataVerified())||($idupdated!=-1)) {
// $this->saybr("ID $idupdated has been changed to $status");
$SQL = "UPDATE test SET
approval= $status
WHERE idxNum = $idupdated ";
//$this->saybr("$SQL");
$rh = $this->dbH->simpleQuery($SQL);
if (DB::isError($rh)) {
SM_fatalErrorPage("unable to access database",$this);
} //end if db error
} //End Data verified
} //End else no initial SQL DB error
} //end Mod Think
} //end Module
?>