Hello. I have a bit of code, and I don't know why it doesn't work.
Error Message:
Fatal error: Call to a member function fetchRow() on a non-object in /blah/blah/tranhist.php
Here is the part that it's talking about (tranhist.php):
<?php
$dbarray = $database->getAcctDet($username);
while($row = $dbarray->fetchRow()) {
echo "$row \n";
}
?>
Here's the function getAcctDet() in database.php:
function getAcctDet($username){
$q = "SELECT * FROM ".TBL_ACCOUNT_ACTIVITY." WHERE username = '$username'";
$result = mysql_query($q, $this->connection) or die(mysql_error());
if(!$result || (mysql_numrows($result) < 1)){
echo "No Transaction History Found";
}
$dbarray = mysql_fetch_array($result);
return $dbarray;
}
I had this working (I think) previously, but I forgot to append the username to the end of the filename, so I just got the error message "No Transaction History Found" every time, and I've since changed this around so much that I can't figure out which way is up anymore. I've actually gotten a while loop to work once on this page (back before I had a clue what I was doing, still don't actually), but lately I can't seem to get it right.
Thanks in advance,
Mendy
P.S. -- I know it isn't my connection to the database. I am able to call up individual cells from my database with the getAcctDet() array, by doing something like this:
<?php
echo $session->acctact['datepost'];
echo $session->acctact['datefund'];
btw,
$session->acctact
is the variable that contains the array for getAcctDet (sorry if I'm redundant).