I'm having a problem with PEAR:😃B. You see, when I use fetchRow() to get the data, it produces an error. There is an exception to this though. I've only found one condition in which it works.
Code:
require_once 'DB.php';
$db_engine = 'mysql';
$db_user = 'e_novative';
$db_pass = 'e_novative';
$db_host = 'localhost';
$db_name = 'wbeasley2';
$datasource = $db_engine.'://'.
$db_user.':'.
$db_pass.'@'.
$db_host.'/'.
$db_name;
$db = DB::connect($datasource, TRUE);
if(DB::isError($db)) {
die($db->getMessage());
}
$db->setFetchMode(DB_FETCHMODE_ASSOC);
// #######
$acctname = 'test';
$sql = "SELECT userid FROM user WHERE acctname=$acctname";
$query = $db->query($sql);
$data = $query->fetchRow();
echo $data['userid'];
?>
This produces: Fatal error: Call to undefined function: fetchrow() in c:\program files\apache group\apache\htdocs\newtest.php
The table is:
userid: 1
acctname: test
encpass: 68dc619bf5eb4719420d8b039ee69818
I played for a bit, and found a way to make it work...
$encpass = '1';
$sql = "SELECT userid FROM user WHERE encpass=$encpass";
$query = $db->query($sql);
$data = $query->fetchRow();
if (!$data) {
echo 'no data';
} else {
echo $data['userid'];
}
That bit of code works, but encpass, as you can see, is invalid. So of course it echo's "no data". But the previous one had valid data, yet it says the function is "undefined" when called on that. Can someone help me, please? I've been trying to figure this out for over an hour... 🙁