Database connection info in cookies
Posted: Sat Dec 18, 2004 3:12 am
I'll keep it short:
Can I save database connection information in a cookie?
let's say I do
Basically, I have a page, where the user will be doing several queries to one database and then come back to the same page, but I don't want to keep opening the database each time the page is called.
Sorry if this is too easy,
Victor
Can I save database connection information in a cookie?
let's say I do
Code: Select all
<?php
$conn = mysql_connect("localhost","user","pwd");
setcookie("conn","$conn");
#then later, after the user fills out a form in the page, and submits it
if($_COOKIE['conn'] ) {
$conn = $_COOKIE(['conn'];
}
?>Sorry if this is too easy,
Victor