Log in

View Full Version : Problem with query for some users


Softcore
11-03-2005, 04:25 AM
Hey guys,

I coded a vbulletin mod for my site, and I have a problem with It which I've looked at for hours and cannot figure out how to fix It.

You see, when a user visits the page for the first time of my mod, they are given a welcome, and asked to click a link to generate their Information In the database, well, upon clicking the link, It generates It, then updates a field In the vb user table from 0 to 1 to show they have generated their Information. It then redirects them back to the screen they started off with, which shows a form to continue on with my mod, rather then the welcome message.

Now all would be fine, but there's a problem. I've gotten about 10 users so far who've I've gotten database emails from saying duplicate row In the database, and I check the users table, and the field Is still set to 0 and not 1. So they are sitting there clicking on the Generate link over and over, when It's already added their Information, but not updated the user's table.

There has been over 300 user's who have used It, and only 10 of those have had the problem, so obviously the query Is fine for some, but not all. It seems to be a growing problem, getting 3 new user's reporting It a day or so, the number Is growing.

My question Is, why might It be failing for some and not all If there was something wrong with It?

Marco van Herwaarden
11-03-2005, 03:36 PM
Impossible to tell without looking at the code.

Softcore
11-03-2005, 07:39 PM
Impossible to tell without looking at the code.
:nervous: should of Included that. I'll post the query that Is failing, the one above It works just fine, as well as the redirect code under It.

// Update setting In USER table
$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET battlesetting=1 WHERE userid='$bbuserinfo[userid]'");

$_REQUEST['forceredirect'] = 1;
$url = "standings.php?do=submitbattle";
eval(print_standard_redirect('redirect_generated') );

Note that I am not getting any database error emails about It failing, It simply just doesn't work for some people.

Guest190829
11-03-2005, 10:47 PM
Try the below query...


// Update setting In USER table
$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET battlesetting='1'
WHERE userid='" .$bbuserinfo[userid] ."'
");