1
alhelalat
Database updates processing of a GET request
  • 2008/11/26 21:24

  • alhelalat

  • Just popping in

  • Posts: 4

  • Since: 2008/8/26


XOOPS dos not allow database update when the code processing of a GET request?
what is the right way to update XOOPS database
during processing of a GET
??

2
ghia
Re: Database updates processing of a GET request
  • 2008/11/27 1:51

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


This depends on the way modules are encoded by their developers. They may take the values to store from POST vars or from GET vars or from both. Most forms are encoded to post their values and thats why modules take only POST vars into account. As the method names say, it's their design and the logical choice.
GET has the disavantage that the length of possible data is limited (because it has to fit in the URL), but there is no other technical reason why it can't be programmed to do so.
But it also implicates that browsing certain links (or even refreshing them) will modify your database and thats where several kinds of trouble starts!

3
alhelalat
Re: Database updates processing of a GET request
  • 2008/11/27 9:11

  • alhelalat

  • Just popping in

  • Posts: 4

  • Since: 2008/8/26


Dear ghia
thanks for the reply
i know php am not a professional as XOOPS team .
i wanna develop a new module it is a forum module .
am using this kind of url
Quote:
XOOPS_SITE/module/forum/index.php?a=vtopic&t=16

lets say i want to update number of topic views .
$a=$_GET['a'];
if (
$a==vtopic){$action=vtopic;}
else {
$action=somethingelse;}
$t=intval($_GET['t'])
here gos some code to out put the topic data .
then
$xoopsDB
->query("UPDATE table SET topic_numviews=topic_numviews+1 WHERE topic_id='".$t."'");

i know if i use mysql_query instate of $xoopsDB->query
it would work fine
but i want to share this module with XOOPS community so i try to make it professional how much it is possible not only for me for the community as well
so what is the right way to process a kind of this queries ????

4
frankblack
Re: Database updates processing of a GET request
  • 2008/11/27 9:14

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


$xoopsDB->queryF("UPDATE table SET topic_numviews=topic_numviews+1 WHERE topic_id='".$t."'");

5
alhelalat
Re: Database updates processing of a GET request
  • 2008/11/27 9:19

  • alhelalat

  • Just popping in

  • Posts: 4

  • Since: 2008/8/26


frankblack thank you

Login

Who's Online

243 user(s) are online (171 user(s) are browsing Support Forums)


Members: 0


Guests: 243


more...

Donat-O-Meter

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

Latest GitHub Commits