Jump to content

PHP session


uglykidjoe

Recommended Posts

Hi,
Guys, I would like to get a help on how to pass a mysql link id from one page to another using session!
I dont want to connect/select_db for each page that needs to query a DB... so thats why i wonder if there's any
idea on how to save that db handle ...
Any hints would be greatly appreciated.
Thank You.

Unsuitable 'joke' removed.
Link to comment
Share on other sites

I don't believe you can and you wouldn't really want to.

Even with mysql_pconnect() use, you still have to make the function call so it gets a chance to find an existing link available (if any):

[a href=\"http://us2.php.net/manual/en/function.mysql-pconnect.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.mysql-pconnect.php[/a]


Good luck.
Link to comment
Share on other sites

[!--quoteo(post=375497:date=May 20 2006, 09:01 AM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 20 2006, 09:01 AM) [snapback]375497[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I don't believe you can and you wouldn't really want to.

Even with mysql_pconnect() use, you still have to make the function call so it gets a chance to find an existing link available (if any):

[a href=\"http://us2.php.net/manual/en/function.mysql-pconnect.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.mysql-pconnect.php[/a]
Good luck.
[/quote]

Thank you toplay, guess i'll have to do it the hard way
Link to comment
Share on other sites

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Thank you toplay, guess i'll have to do it the hard way[/quote]

What do you consider the hard way? Typing the connection on every page? Yes, that is the hard way.

Just put your connection data in one file and just include it at the top of every page. Better than typing it on every single page!

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.