vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Can someone check this short chunk of my code? (https://vborg.vbsupport.ru/showthread.php?t=111405)

XanderMahony 03-26-2006 04:43 PM

Can someone check this short chunk of my code?
 
After adding this code to a non-vB page on my site, I started getting about 20 of these errors:

Quote:

Link-ID == false, connect failed
mysql error:

mysql error number: 0
from random pages in my forum everyday. Previously, I got vBulletin errors at the rate of maybe a couple a week. Was it coincidence, or could this code be causing the problems?

PHP Code:

<?php 
error_reporting
(0);


$db mysql_connect("********""********""********");
mysql_select_db("********",$db);

$numbersmembers=mysql_fetch_array(mysql_query('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user'));
$numbermembers=number_format($numbersmembers['users']);
$countposts=mysql_fetch_array(mysql_query('SELECT COUNT(*) AS posts FROM post'));
$totalposts=number_format($countposts['posts']);
$countthreads=mysql_fetch_array(mysql_query('SELECT COUNT(*) AS threads FROM thread'));
$totalthreads=number_format($countthreads['threads']);
 
echo 
"$totalposts $totalthreads $numbermembers";
$thread_sql mysql_query("SELECT threadid,title,lastposter,forumid FROM thread WHERE visible=1 AND open=1 AND (forumid=2 OR forumid=23 OR forumid=27 OR forumid=18 OR forumid=3 OR forumid=17 OR forumid=26 OR forumid=19 OR forumid=30 OR forumid=20) ORDER BY lastpost DESC LIMIT 10");
while(
$thread_get=mysql_fetch_array($thread_sql))
{
$poster $thread_get['lastposter'];
$tid $thread_get['threadid'];
$psql mysql_query("SELECT postid FROM post WHERE threadid=$tid ORDER BY postid DESC");
$getp=mysql_fetch_array($psql);
$pid $getp['postid'];
$title $thread_get['title'];
$title substr($title,0,60);
$forumid $thread_get['forumid'];
$forumnames mysql_fetch_array(mysql_query("SELECT title FROM forum WHERE forumid=$forumid"));
$forumname $forumnames['title'];
echo 
"$pid $pid $title $forumid $forumname";
}
?>

Thanks.

IrPr 03-26-2006 11:31 PM

Check the vBulletin.com

Paul M 03-27-2006 07:28 AM

That error means that it could not connect to the mysql server - the only thing I can think of is that you don't seem to close any connection you make, so maybe you are running out of conections (but tbh, I would expect a different error for that).

XanderMahony 03-28-2006 04:45 PM

I put in code to close the connection and I've had no errors since. Strange that it didn't give the 'Too Many Connections' error, but thanks for fixing my problem Paul !

Paul M 03-30-2006 06:31 AM

Glad you got sorted :up:


All times are GMT. The time now is 06:39 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01098 seconds
  • Memory Usage 1,733KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete