Avoid to open mysql querries then times in the page

From: Date: Mon, 04 May 2009 22:20:51 +0000
Subject: Avoid to open mysql querries then times in the page
Groups: php.general 
Request: Send a blank email to php-general+get-292246@lists.php.net to get a copy of this message
Hello, I'm a totally newbie to php/Mysql but I'd like to know if it is normal that I have to connect 3 times to the db in one page. For example, I have 1. A connection for the login / pass a $_SESSION['login'] before the HTML tags 2. I need to say hello to the user so I reconnect, run a query to select the user having the login and echo 'Hello '.$user['login'].'!'' 3. I need to show him his friends a bit later, so I have to connect a last time and re-run a querry because I can't use the data $user that I used in my upper php code... Is there a walkthroug to have only one connection for the page? Thanks Matthieu

« previous php.general (#292246) next »