Jump to content


Photo

PHP session


  • Please log in to reply
3 replies to this topic

#1 uglykidjoe

uglykidjoe
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 20 May 2006 - 12:55 PM

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.

#2 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 20 May 2006 - 02:01 PM

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.

#3 uglykidjoe

uglykidjoe
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 21 May 2006 - 04:55 AM

[!--quoteo(post=375497:date=May 20 2006, 09:01 AM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 20 2006, 09:01 AM) View Post[/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

#4 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 21 May 2006 - 06:22 AM

[!--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--]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users