Okay well I answered my own dumb question on this one the server on
which I was running these on did not have postgresql support built in
but now I'm running into another problem. When I try to disconnect from
the server using pg_close in a method(function) I can't seem to find out
which link to use because I called the connection with a method also.
Any ideas?
Below is the code to the class
<?
// Database.class
/* This class will specifiy options and methods you can use to connect
to a databaseserver and use the methods to pull data connect and insert
or delete data
*/
class Database
{
var $connection;
function Database()
{
print ("In Database Constructor<br>");
} // end Database Constructor
function connectDb($host,$user,$dbname,$pw)
{
print ("Starting Database connection...<br>");
$connection = pg_connect("host=$host user=$user dbname=$dbname
password=$pw");
return $connection;
} // end connectDb method
function freeResult($result)
{
pg_freeresult($result);
} // end freeResult method
function disconnectDb($con)
{
print ("<br><br>Closing Connection...");
pg_close($con);
} // end disconnectDb method
}// end class Database
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Smileyq) wrote:
> I have recently been trying to create a class called Database with
> methods inside it to ease my coding with web applications. I've noticed
> though when I create an object from the class like
> $x = new Database();
> Then try to call the connectDB() method (function we call it in PHP)
> like so
>
> $x->connectDb(bla bla bla bla);
> I get the error message that the function cannot be found as if it is
> for some reason looking in the class itself for a function of pg_connect
> when it should be using the PHP libriaries instead. Anybody else run
> into this problem or know a way to fix it.
>
> Thanks
> ---
> Sloan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php