hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Need Urgent Help in MySQL
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

Need Urgent Help in MySQL

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 02-24-2002, 12:24 PM
2cool2 2cool2 is offline
New Member
 
Join Date: Feb 2002
Posts: 1

Need Urgent Help in MySQL


<?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!

Reply With Quote


Sponsored Links
  #2  
Old 02-24-2002, 02:38 PM
jks jks is offline
Web Hosting Master
 
Join Date: Apr 2001
Location: Denmark, Europe
Posts: 614
Re: Need Urgent Help in MySQL

Quote:
Originally posted by 2cool2
<?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!
Yes, it does close the connection.

By the way: Did you include all the code that you have here? - The code above seems quite weird.

I guess you "accidentiallly" left out important bits. Like why does it say "use pconnects" when it actually have no option for doing so.

If you're actually using pconnects (which is not shown above), then no, it does not close the connection.

__________________
Jens Kristian Søgaard, Mermaid Consulting ApS,
jens@mermaidconsulting.dk,
http://www.mermaidconsulting.com/

Reply With Quote
  #3  
Old 02-24-2002, 06:58 PM
sjau sjau is offline
WHT Addict
 
Join Date: Feb 2002
Location: Switzerland
Posts: 103
isn't mysql connection automatically being closed at the end of the script even if there is a pconnection while normal connection just close after the query has been made!?!

__________________
sjau
*
"The third principle of sentient life is the capacity for self-sacrifice, the conscious ability to override evolution and self-preservation for a cause, a friend, a loved one."

Reply With Quote
Sponsored Links
  #4  
Old 02-24-2002, 07:03 PM
jks jks is offline
Web Hosting Master
 
Join Date: Apr 2001
Location: Denmark, Europe
Posts: 614
Quote:
Originally posted by sjau
isn't mysql connection automatically being closed at the end of the script even if there is a pconnection while normal connection just close after the query has been made!?!
No.

mysql_pconnects does not close the connections at the end of the script (but at the end of the slave's lifetime).

Ordinary mysql_connects does close the connection at the end of the script, not after a query has been made.

__________________
Jens Kristian Søgaard, Mermaid Consulting ApS,
jens@mermaidconsulting.dk,
http://www.mermaidconsulting.com/

Reply With Quote
  #5  
Old 02-24-2002, 07:07 PM
sjau sjau is offline
WHT Addict
 
Join Date: Feb 2002
Location: Switzerland
Posts: 103
I'm never sure what way is right. Thanks for the the clarification!

__________________
sjau
*
"The third principle of sentient life is the capacity for self-sacrifice, the conscious ability to override evolution and self-preservation for a cause, a friend, a loved one."

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Web Host Rackspace Launches Private Beta for MySQL Cloud Database Web Hosting News 2011-12-01 21:09:51
Parallels Now Offering Licenses for CloudLinux OS Web Hosting News 2011-10-26 17:29:25
Web Hosting Sales and Promos Roundup - October 7, 2011 Web Hosting News 2011-10-07 19:56:18
Web Hosting Software Firm CloudLinux Releases CloudLinux OS Version 6.1 Web Hosting News 2011-09-13 14:08:49
Web Host FireHost Partners with Cloud Security Firm Gazzang for Data Encryption Web Hosting News 2011-08-16 20:33:43


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?