PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 8th, 2000, 01:43 PM
riddler riddler is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 1999
Posts: 37 riddler User rank is Sergeant (500 - 2000 Reputation Level)riddler User rank is Sergeant (500 - 2000 Reputation Level)riddler User rank is Sergeant (500 - 2000 Reputation Level)riddler User rank is Sergeant (500 - 2000 Reputation Level)riddler User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 h 52 m 50 sec
Reputation Power: 24
I'm totally confused about when and how to use mysql_pconnect() vs mysql_connect().

I'm creating a sql wrapper function:

function sql_wrapper ($sSql) {

  $iConn = mysql_connect();
  $iResult = mysql_db_query ("db", $sSql, $iConn);

  ...
  ...

}

Which function should I use?
Should $iConn be a static variable?

If I want to use mysql_insert_id(), do I have to use mysql_connect to keep the threads separate?

Help!

Reply With Quote
  #2  
Old May 9th, 2000, 05:28 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
riddler,

Major difference between the mysql_pconnect() and mysql_connect() is that mysql_pconnect will open a persistent connection to a MySQL Server.but in the case of mysql_connect() it opens a simple connection to a MySQL Server.

see the difference here in the following links:
http://www2.phpbuilder.com/manual/f...l-pconnect.php3
http://www2.phpbuilder.com/manual/f...ql-connect.php3

You can use eigther of this function as per your project requirment.




------------------
SR -
shiju.dreamcenter.net

Reply With Quote
  #3  
Old May 9th, 2000, 08:23 AM
riddler riddler is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 1999
Posts: 37 riddler User rank is Sergeant (500 - 2000 Reputation Level)riddler User rank is Sergeant (500 - 2000 Reputation Level)riddler User rank is Sergeant (500 - 2000 Reputation Level)riddler User rank is Sergeant (500 - 2000 Reputation Level)riddler User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 h 52 m 50 sec
Reputation Power: 24
Hi SR,

I've read all of the documentation about the functions and I understand what they do. What I'm confused about are the practical effects of each.

When is it desirable to use a persistent connection? When is it perilous to do so?

Does mysql_pconnect() mean that the entire application will only use one connection to the database throughout the *entire* lifetime of the app?

Will it always use a single thread?

If I want to capture the last insert ID, do I have to use mysql_connect() instead?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > mysql_pconnect()

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap