note 30243 added to function.mysql-connect
| From: | amn at rack1 dot php dot net | Date: | Wed, 12 Mar 2003 04:40:13 +0000 |
| Subject: | note 30243 added to function.mysql-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45128@lists.php.net to get a copy of this message | ||
Just in case you didn't know. You can use mysql_connect in a function to connect to a database
and the connection is a super-global... meaning you can use mysql_query in other functions or in no
function at all and PHP will use the connection that you opened. This is a handy bit of knowledge
that helps if you have a large site with lots of scripts. If you create one function to connect to a
db, and call that function in all your scripts, it makes for easier code maintenance since you only
have to update one line of code to change your mysql connection instead of updating all your scripts
individually.
--
http://www.php.net/manual/en/function.mysql-connect.php
http://master.php.net/manage/user-notes.php?action=edit+30243
http://master.php.net/manage/user-notes.php?action=delete+30243
http://master.php.net/manage/user-notes.php?action=reject+30243