Balance transferring transaction - PHP and MySQL

I'm in a middle of a project and I need to create a page in which the user account will be able to transfer a certain amount of "money" to another registered account. After the transfer action ends, I need to have a transcript of the transaction. I created a new DB that contains all the transactions but I can't figure out how to call the data.
I tried to use this in the api.php:
`//get all transactions case "get_all_transactions":
$cursor = $MySQLdb->prepare("SELECT * FROM transactions");
$cursor->execute();
$retval = "";
foreach($cursor->fetchAll() as $row){
if ($row["send_account"] == $user OR $row["recive_account"] == $user){
$retval = retval . "<br>"echo .$row['send_account']."<br>".$row['recive_account']."<br>".$row['amount'];
}else{
$msg = "nope";
}
}
echo '{"success":"true","data":"'.$retval.'"}';
die();
break;`
I add this in the transaction.php page:
//get all transactions
$.post("api.php",{"action":"get_all_transactions"},function(data){
if(data.success == "true"){
$("#transactions_history").html(data.data);
}
});
I can't figure out how to continue.
Can anyone assist, please?
If you have any other way, it will be great.
Thanks!
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: object of class stdclass could not be converted to string
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.