I am receiving an error that I'm struggling to overcome - I've inserted numerous echo statements in order to figure out what is actually happening, however I still haven't managed to resolve the issue. Here is the PHP code:
class Payment extends DAO {
private $table = "fss_Payment";
public function __construct() {
parent::__construct($this->table);
}
public function addPayment($totalAmount){
$queryAddPayment = sprintf("
INSERT
INTO
fss_Payment(amount, paydate, shopid, ptid)
VALUES('%s', '%s', '%s', '%s')"
, $totalAmount
, date("Y-m-d")
, 1
, 2
);
echo $queryAddPayment;
parent::query($queryAddPayment);
}
public function getPayment(){
$queryGetPayment = "
SELECT
payid
FROM
fss_Payment
ORDER BY
payid DESC
LIMIT 1
";
$e = new \Exception;
var_dump($e->getTraceAsString());
return parent::query($queryGetPayment);
}
public function addAndGetPayment($totalAmount){
$this->addPayment($totalAmount);
return $this->getPayment()->fetch_assoc();
}
}
?>
The getPayment() method is where the error is, the query is returning the following error:
Unknown column 'payid' in 'field list, despite the table has a payid field.
I understand that the fields are inserted correctly, but the problem lies in retrieving those queries. Thank you