1
I am trying to create a new module for my own purpose. I have creat a page to update some product name against product id. It's very simple task and I am able to do it using my function. But whenever I try to update using xoops's code I am unable to do it. The code is as follows:-
include '../../mainfile.php';
// Include the page header
include(XOOPS_ROOT_PATH.'/header.php');
global $xoopsDB;
if ( $xoopsUser )
{
$i=1;
foreach ( $HTTP_GET_VARS as $k => $v )
{
$arr[$i]= $v;
$i++;
}
print $arr[1];
if(! $xoopsDB->query("UPDATE ".$xoopsDB->prefix('exchange')." SET pname='dfdfdf' where pid=".$arr[1] ))
{
echo "Could not update product";
}
else
{
redirect_header("offer.php",1,_XD_DBSUCCESS);
}
}
else
{
redirect_header("index.php",3,_NOPERM);
exit();
}
include(XOOPS_ROOT_PATH.'/footer.php');
?>
Table name exchange
Table structure is:
pid int(4)
pname= varchar(100)
Wating for reply.