Functions in a .inc file
| From: | Mark Colvin | Date: | Mon, 17 Jun 2002 14:20:14 +0000 |
| Subject: | Functions in a .inc file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-102517@lists.php.net to get a copy of this message | ||
Hi,
I have a function (ConnectToDatabase) in an include file that opens a
connection to a mysql database. I call this function from another function
in the same include file. This doesn't work. If I copy the code from the
(ConnectToDatabase) function and paste it into the top of my second function
and comment out the call to (ConnectToDatabase) everything works OK. Why is
this? I want to have a persistent connection opened so that I don't have to
insert the database access code before every call to the database.
Also, I'm new to PHP and use this syntax to call my functions :
$db->ConnectToDatabase()
What does the -> mean?
Is this the same as saying
$db = ConnectToDatabase()
Thanks in advance
Mark
****************************************************
This e-mail is intended for the recipient only and
may contain confidential information. If you are
not the intended recipient then you should reply
to the sender and take no further ation based
upon the content of the message.
Internet e-mails are not necessarily secure and
CCM Limited does not accept any responsibility
for changes made to this message.
Although checks have been made to ensure this
message and any attchments are free from viruses
the recipient should ensure that this is the case.
****************************************************