johnrau
06-01-2004, 12:36 AM
heres a class i wrote -- when i try $db->query(*) it returns the following:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/trulyta/public_html/new/globals.inc.php on line 19
the code:
class db {
function open() {
$this->host = "localhost";
$this->name = "*";
$this->user = "*";
$this->pass = "*";
$this->resource = mysql_connect($this->host, $this->user, $this->pass);
mysql_select_db($this->name, $this->resource);
register_shutdown_function($this->close);
}
function query($query) {
// this is line 19, where it says the error is:
$result = mysql_query($query, $this->resource);
return $result;
}
function close() {
mysql_close($this->resource);
}
}
$db = new db;
$db->open;
$db->query("SELECT * FROM tt_drinks WHERE id = 1032");
$db->close;
any ideas would be greatly appreciated!!! thanks!
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/trulyta/public_html/new/globals.inc.php on line 19
the code:
class db {
function open() {
$this->host = "localhost";
$this->name = "*";
$this->user = "*";
$this->pass = "*";
$this->resource = mysql_connect($this->host, $this->user, $this->pass);
mysql_select_db($this->name, $this->resource);
register_shutdown_function($this->close);
}
function query($query) {
// this is line 19, where it says the error is:
$result = mysql_query($query, $this->resource);
return $result;
}
function close() {
mysql_close($this->resource);
}
}
$db = new db;
$db->open;
$db->query("SELECT * FROM tt_drinks WHERE id = 1032");
$db->close;
any ideas would be greatly appreciated!!! thanks!