PDA


View Full Version : Database errors with sidebars on custom pages.


trackpads
11-25-2005, 10:28 PM
This doesnt happen everytime but I have been getting these emails all day from about every user on the site. The problems started when I modified my forumhome and my forumdisplay to use the cmps sidebars. Here is the error email:

Database error in vBulletin 3.5.0:

Invalid SQL:

INSERT INTO session
(sessionhash, userid, host, idhash, lastactivity, location, styleid, languageid, loggedin, inforum, inthread, incalendar, badlocation, useragent, bypass, injournal)
VALUES
('867fe0a984ba69447bace99aa0d25336', 0, '172.130.248.199', '45c2f2aeb167f5a6f42627f288184dcb', 1132971945, '/forum/', 0, 0, 0, 0, 0, 0, 0, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 (ax)', 0, -1);

MySQL Error : Duplicate entry '867fe0a984ba69447bace99aa0d25336' for key 1
Error Number : 1062
Date : Friday, November 25th 2005 @ 08:25:47 PM
Script : http://www.trackpads.com/forum/
Referrer : http://www.theadminzone.com/forums/showthread.php\?t=14628
IP Address : 172.130.248.199
Username : Unregistered
Classname : vb_database

Thanks again,

-Jason

trackpads
11-28-2005, 08:25 AM
Bumpola, bug submitted etc etc. I got 88 of these this morning!! Help!

KW802
11-28-2005, 12:43 PM
Jason,

That type of error is really Brian's forte.... when you disable the CMPS columns the errors also stop?

trackpads
11-28-2005, 07:18 PM
Yeah, but i want to keep them. CMPS is awesome now that I am getting good at it :)

Zachery
11-28-2005, 09:40 PM
Seems like its trying to update the session twice on one page maybe?

This is really brians type of thing, he should be back tomorrow.

I'd suggest keeping it disabled for now.

trackpads
11-28-2005, 10:09 PM
Cant looks sooo good, my members will adapt to the every challenging environment at trackpads.com :) :) :)

I apprecaite all the help!

-Jason

Brian
11-30-2005, 02:22 PM
How long ago did you integrate these other pages? The instructions were just changed about 2 weeks ago or so to prevent that exact error.

trackpads
11-30-2005, 02:29 PM
Over the thanksgiving day weekend and I followed it to a T. I will recheck tonight when I get home (work now)

Thanks again for all of this,

-Jason

trackpads
11-30-2005, 02:42 PM
I think I found the bug, I am using 'forumhome' as the page identifier. Is that perchance something vb also uses?

trackpads
11-30-2005, 03:45 PM
Ah dang, that wasnt it. I will recheck when I get home, darnit!

KW802
11-30-2005, 03:58 PM
Ah dang, that wasnt it. I will recheck when I get home, darnit!... but I do like that db error page you created. :p

"You broke it!" :D

trackpads
11-30-2005, 04:42 PM
I got it off vb.org, it was hilarious when I saw it!!

trackpads
11-30-2005, 04:48 PM
Brian,

I checked the instructions here:

http://www.vbadvanced.com/membersarea.php?do=viewusermanual&productid=4&pageid=6

And I followed them to the letter but no luck,

Thanks again,

-Jason

trackpads
11-30-2005, 09:45 PM
Yup, still no luck, double checked everything and it still shows.

Thanks again,

-Jason

Brian
12-01-2005, 06:00 PM
Would you mind submitting a support ticket so I can have a look then?

trackpads
12-01-2005, 06:09 PM
Would you mind submitting a support ticket so I can have a look then?
Already had one in! :)

trackpads
12-02-2005, 08:53 PM
Bump :)

trackpads
12-03-2005, 07:37 PM
Bump

trackpads
12-04-2005, 10:06 AM
Would you mind submitting a support ticket so I can have a look then?
I did, it was closed, so I reopened it :(

trackpads
12-06-2005, 09:50 PM
I am bumping for sheer joy now :)

booth
01-25-2006, 01:41 PM
Is there a fix for this? I'm having exactly the same problem.

It's only happening with Members. If a member logs in and clicks the 'remember me?' tickbox, then leaves the site. When that user returns they get this error message:

Database error in vBulletin 3.5.0:

Invalid SQL:

INSERT INTO vb3_session
(sessionhash, userid, host, idhash, lastactivity, location, styleid, languageid, loggedin, inforum, inthread, incalendar, badlocation, useragent, bypass)
VALUES
('0ad0211f7cc53c8ff5cd80b40488971e', 3, '194.82.37.50', 'a690cadcc94967cb619ab4d084f745ce', 1138210815, '/', 0, 0, 0, 0, 0, 0, 0, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)', 0);

MySQL Error : Duplicate entry '0ad0211f7cc53c8ff5cd80b40488971e' for key 1
Error Number : 1062
Date : Wednesday, January 25th 2006 @ 05:40:15 PM
Script : http://www.blackburn247.com/
Referrer :
IP Address : *******
Username : *****
Classname : vb_database

It's okay for guests, and if you log off before you leave the site.

Please help! It's really annoying.

Site is www.blackburn247.com

Brian
01-25-2006, 01:50 PM
http://www.vbadvanced.com/membersarea.php?do=viewusermanual&productid=4&pageid=6

Make sure you're using the exact code from that page. It was updated a few weeks ago to resolve the problem you're describing.

booth
01-25-2006, 02:37 PM
Agh, I implemented that code only last night so I'm pretty sure it's correct. When I'm in a position to verify this I will. I'm at work at the moment so can't ftp in. Will try and verify tomorrow.

booth
01-25-2006, 03:44 PM
I can now confirm that I added that code exactly as described.

My forums and Vbadvanced are installed in the same folder.

Any help?

Brian
01-25-2006, 05:40 PM
Can you post the code from your functions.php file, starting with this line:
function print_output($vartext, $sendheader = true)

And then about 20 lines down?

booth
01-26-2006, 08:37 AM
Okay as requested:

From functions.php (I've added more than 20 lines just in case)...
function print_output($vartext, $sendheader = true)
{
global $pagestarttime, $querytime, $vbulletin;
global $vbphrase, $stylevar;

if (defined('NOSHUTDOWNFUNC'))
{
exec_shut_down();
}
if (defined('VBA_PORTAL') AND !defined('SKIP_OUTPUT') AND !defined('VBA_SCRIPT') AND !defined('NOPMPOPUP'))
{
define('SKIP_OUTPUT', true);

global $home;

print_portal_output($home, $vartext);
}
if ($vbulletin->options['addtemplatename'])
{
if ($doctypepos = @strpos($vartext, $stylevar['htmldoctype']))
{
$comment = substr($vartext, 0, $doctypepos);
$vartext = substr($vartext, $doctypepos + strlen($stylevar['htmldoctype']));
$vartext = $stylevar['htmldoctype'] . "\n" . $comment . $vartext;
}
}

if ($vbulletin->db->explain)
{
$pageendtime = microtime();

$starttime = explode(' ', $pagestarttime);
$endtime = explode(' ', $pageendtime);

$totaltime = $endtime[0] - $starttime[0] + $endtime[1] - $starttime[1];

$vartext .= "<!-- Page generated in " . vb_number_format($totaltime, 5) . " seconds with " . $vbulletin->db->querycount . " queries -->";
}

// --------------------------------------------------------------------
// temporary code
global $_TEMPLATEQUERIES, $tempusagecache, $DEVDEBUG;
if ($vbulletin->debug)
{
$pageendtime = microtime();
$starttime = explode(' ', $pagestarttime);
$endtime = explode(' ', $pageendtime);
$totaltime = vb_number_format($endtime[0] - $starttime[0] + $endtime[1] - $starttime[1], 5);
devdebug('php_sapi_name(): ' . SAPI_NAME);


Many thanks ;)

Brian
01-26-2006, 03:59 PM
What version of vBulletin are you running? The code in your functions.php file seems to be slightly different than what I see in my files, and I've seen a couple of other people with the same code. If you'll remove this line though:
if (defined('VBA_PORTAL') AND !defined('SKIP_OUTPUT') AND !defined('VBA_SCRIPT') AND !defined('NOPMPOPUP'))
{
define('SKIP_OUTPUT', true);

global $home;

print_portal_output($home, $vartext);
}

And move it to just above this code instead:
if (defined('NOSHUTDOWNFUNC'))

Then that should take care of the problem.

booth
01-26-2006, 07:27 PM
That appears to have fixed it. Thankyou very much you've made a handful of people in a small town in the UK a bit happier :)

I should have mentioned that I'm using Vbulletin version 3.5.0 with security patches.