NOW I'm missing something basic
| From: | Martin | Date: | Sun, 04 Nov 2001 07:09:21 +0000 |
| Subject: | NOW I'm missing something basic | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-469@lists.php.net to get a copy of this message | ||
I'm trying to get
function exists($name)
{
$sql = "SELECT * FROM users WHERE (name='$name')";
$res = $db->query($sql);
if (DB::isError($res)) {
die ($res->getMessage());
}
if($res)
{
$Rows = $res->numRows();
if($Rows > 0)
{
return(TRUE);
} else
{
return(FALSE);
}
}
To return something useful (below if($Rows > 0)). It doesn't.
I have
require_once("DB.php");
$dsn="mysql://$cfg_dbuser:$cfg_dbpasswd@$cfg_dbhost/$cfg_dbname";
in the code and this apparently works.
Now: $res = $db->query($sql);
doesn't seem to do anything. After some time :-/ researching this I found
that query isn't in DB.php but DB/common.php. So do I include that file
somewhere? If I try I get:
Fatal error: Class db_common: Cannot inherit from undefined class pear in
/usr/local/lib/php4/pear/DB/common.php on line 30
Martin