1
kalamata
Database error of zero
  • 2006/6/21 10:41

  • kalamata

  • Not too shy to talk

  • Posts: 121

  • Since: 2005/3/3 1


Dear All,

I made a small modification to the code for the xfguestbook module (will post it as soon as I am sure that it works) and run into the following problem that I can not understand:

I want to delete all modules waiting for validation, so I created a duplicate of the delete routine and call it from the main menu. What is happening is that if I use the code in delete

if (!$result = $this->db->query($sql)) {
echo "Problem with deletion!", mysql_errno();
return false;
}
to perform the deletion it will return an error number of zero, whilst if I run it the traditional way:

mysql_query($sql)

this works fine without any problems at all.

I should note here that when I use the code of delete in XOOPS then this error is not coming up.

From a search online, I found that an error number of zero means that either the database is down or that it reached its connection limit. Neither of these is true in my case.
Any offeres for explaining this behaviour?

Thanks,
George

2
Dave_L
Re: Database error of zero
  • 2006/6/21 13:13

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


You either need to use queryF() instead of query(), or perform this processing via a POST request instead of a GET request.

3
kalamata
Re: Database error of zero
  • 2006/6/21 16:15

  • kalamata

  • Not too shy to talk

  • Posts: 121

  • Since: 2005/3/3 1


ok, will try. But, what is the problem with the query method?

George

4
Dave_L
Re: Database error of zero
  • 2006/6/21 17:08

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


It's a XOOPS security feature.

5
kalamata
Re: Database error of zero
  • 2006/6/27 16:16

  • kalamata

  • Not too shy to talk

  • Posts: 121

  • Since: 2005/3/3 1


Quote:

Dave_L wrote:
It's a XOOPS security feature.


Can you give me some pointers where I can find out more about this feature?

Thanks,
George

6
Dave_L
Re: Database error of zero
  • 2006/6/27 17:04

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


HTTP requests made using the GET method (browsing to a URL, clicking a link) are, by default, restricted to doing SELECT queries, which only read from the database.

This restriction can be overridden by using the queryF() method, instead of the query() method. You should only do this when it's necessary and reasonable safe to do so. Updating the Who's Online info is one case where it's necessary, since that information requires updating the database as a result of link-clicking with no form submission.

HTTP requests made using the HTTP POST method (form submissions) are allowed to do all queries.

The rationale is that POST requests are more difficult to spoof.

Does that answer your question?

7
kalamata
Re: Database error of zero
  • 2006/6/27 18:06

  • kalamata

  • Not too shy to talk

  • Posts: 121

  • Since: 2005/3/3 1


Many thanks Dave - you answered it. I thought that the HTTP protocol does not restrict the type of query you can run but just defines two different ways of passing information to the server.

George

8
Dave_L
Re: Database error of zero
  • 2006/6/27 18:38

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Just for clarification, it's XOOPS that imposes the restriction, not HTTP. The code is in class/mysqldatabase.php.

Login

Who's Online

311 user(s) are online (252 user(s) are browsing Support Forums)


Members: 2


Guests: 309


kalibri, margoritka,

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