By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,712 Members | 1,548 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,712 IT Pros & Developers. It's quick & easy.

Return value from function

P: n/a
I wanted to centralize connection to a MySQL database, so I created a
function that reads (eliminating extraneous)

function connectDB() {
$db = mysql_connect(-------);
mysql_select_db("dbname");
return $db;
}

In my main routine I have

$db = connectDB();
----Database activity------
mysql_close($db);

Problem: I get an error message at this point telling me that this isn't a
valid mysql reference. Why? I'm probably overlooking it, but I don't see a
limitation on the return value in the documentation.

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.