I am novice at PHP and I am trying to use an array to pull data from different tables within a database. Then to report that data to a form that i have created.
I have created separate functions that pulls the data from the database. Which they work because I can pull data when I set the array up to pull from only one table.
This is the array that I have to created. I know this is wrong... probably not even close. I can get it to work when pull the data one table but I am struggling to pull from multiple tables.
This is my connection and array to the DB.
<?php
/*Accounts*/
$currentMember->connection = $conn;
$accounts = $currentMember->retrieve_all_accounts();
/*Loop through account - Grabs data*/
while($account = mysqli_fetch_assoc($accounts)){
$transactionlog->connection = $conn;
/*Retrieve Account data*/
$transactionlog = new Bankaccount($account['BankAccountID'] );
//Different table within that database
$transactionlog = mysqli_fetch_assoc($transactionlog->retrieve_transactions());
$transactionlog->connection = $conn;
//Different table within the database
//$transactionlog = mysqli_fetch_assoc($transactionlog->retrieve_transactiontype());
echo '<tr>' . "\n";
echo "\t" . '<td>' . $account['BankAccountID'] . '</td>' . "\n";
echo "\t" . '<td>' . date($transactionlog['TransactionDate'] ) . '</td>' . "\n";
echo "\t" . '<td>' . $account($transactionlog['TransactionType']) . '</td>' . "\n";
echo "\t" . '<td>$' . $account($transactionlog['TransactionAmount'], 2) . '</td>' . "\n";
echo "\t" . '<td>$' . number_format($balance['CurrentBalance'], 2) . '</td>' . "\n";
echo '<tr>' . "\n";
}
/*Close DB*/
mysqli_close($db->connection);
?>
I have created separate functions that pulls the data from the database. Which they work because I can pull data when I set the array up to pull from only one table.
This is the array that I have to created. I know this is wrong... probably not even close. I can get it to work when pull the data one table but I am struggling to pull from multiple tables.
This is my connection and array to the DB.
<?php
/*Accounts*/
$currentMember->connection = $conn;
$accounts = $currentMember->retrieve_all_accounts();
/*Loop through account - Grabs data*/
while($account = mysqli_fetch_assoc($accounts)){
$transactionlog->connection = $conn;
/*Retrieve Account data*/
$transactionlog = new Bankaccount($account['BankAccountID'] );
//Different table within that database
$transactionlog = mysqli_fetch_assoc($transactionlog->retrieve_transactions());
$transactionlog->connection = $conn;
//Different table within the database
//$transactionlog = mysqli_fetch_assoc($transactionlog->retrieve_transactiontype());
echo '<tr>' . "\n";
echo "\t" . '<td>' . $account['BankAccountID'] . '</td>' . "\n";
echo "\t" . '<td>' . date($transactionlog['TransactionDate'] ) . '</td>' . "\n";
echo "\t" . '<td>' . $account($transactionlog['TransactionType']) . '</td>' . "\n";
echo "\t" . '<td>$' . $account($transactionlog['TransactionAmount'], 2) . '</td>' . "\n";
echo "\t" . '<td>$' . number_format($balance['CurrentBalance'], 2) . '</td>' . "\n";
echo '<tr>' . "\n";
}
/*Close DB*/
mysqli_close($db->connection);
?>