PDA

View Full Version : Need Urgent Help in MySQL



2cool2
February 24th, 2002, 09:59
<?php
$maxthreads = 6;
$dbservertype="mysql";
$servername="xxxxxx";
$dbusername="xxxxx";
$dbpassword="xxxxx";
$dbname="xxxxx";
$pwdincp=0;
$technicalemail = "xxx@xxx.com";
$usepconnect = 1;

$db=mysql_connect($servername,$dbusername,$dbpassword);
mysql_select_db($dbname);
$query = "SELECT * FROM thread ORDER BY lastpost DESC LIMIT $maxthreads";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
echo "<b><a target=new href=\"http://www.domain.com/forum/showthread.php?threadid=$latest_array[threadid]\">$latest_array[title]</a><br><br></b>";
}
?>

---------------------------------------------

My Question
The script is opening a session with MySQL, Is it closing it?
Yes or No? If No, How to make the script close the session?

Thanks you very much!

niv
February 24th, 2002, 11:04
Since you're using mysql_connect(), it automatically closes at the end of the script...

2cool2
February 24th, 2002, 11:11
Are you sure :)?

Because where my site is hosted some one opens a session and does not close it

And my host have sent a mail to every one to check if it is their script is causing the problme and if it is not sloved they will find out who is doign it and dellete his site :(

So i dont want my site to close down!

I just use 2 things
1. a vBulletin forum 2.2.2 (I have around 10-35 people online at any tiem of day)
2. and the script which is posted above

So are you sure it is not my script which is opening sessions and not closing it :)

I just want to be sure :)

niv
February 24th, 2002, 11:29
Try looking it up on php.net, I know there is a mysql_close() or a mysql_disconnect() of some sort...

2cool2
February 24th, 2002, 12:21
I am new to MySQL :(

So, can you tell me where should i add the disconnect command :)?

Thanks in Advance

megapuzik
February 24th, 2002, 14:06
Originally posted by 2cool2


can you tell me where should i add the disconnect




mysql_close($link) ;


:confused: :confused: :confused:

Woofcat
February 25th, 2002, 20:58
it closes automatically... just go through all your scripts and replace any occurence of mysql_pconnect with mysql_connect and you're all good...

2cool2
February 26th, 2002, 11:58
Thanks! the problme is solved :)