467,867 Members | 1,411 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,867 developers. It's quick & easy.

Return value from function

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
  • viewed: 1234
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

17 posts views Thread by strout | last post: by
10 posts views Thread by LaEisem | last post: by
3 posts views Thread by tshad | last post: by
5 posts views Thread by Dmitriy Lapshin [C# / .NET MVP] | last post: by
12 posts views Thread by Michael Maes | last post: by
20 posts views Thread by lovecreatesbeauty | last post: by
2 posts views Thread by mosesdinakaran | last post: by
7 posts views Thread by Terry Olsen | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.