1
shivaji
Could not update data in tables
  • 2003/10/20 14:56

  • shivaji

  • Friend of XOOPS

  • Posts: 179

  • Since: 2003/9/18


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.

2
Mithrandir
Re: Could not update data in tables

Can't update database with GET values through $xoopsDB->query

Use $xoopsDB->queryF instead - but keep in mind that GET values can be given in URL... if you get the values from a form, consider using POST instead.

3
shivaji
Re: Could not update data in tables
  • 2003/10/21 6:46

  • shivaji

  • Friend of XOOPS

  • Posts: 179

  • Since: 2003/9/18


ya now it's working perfectly.

Thanks again for your excellent support.



Login

Who's Online

180 user(s) are online (116 user(s) are browsing Support Forums)


Members: 0


Guests: 180


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits