I have this array and it is generated by a select statement:
// SELECT STATEMENT:
$getUsers = "
SELECT users.id_users,users.username,accounts.acctno,accounts.acctname,accounts.last_bal
FROM users,accounts
WHERE users.id_household = '$id_household' AND users.id_users=accounts.id_users
ORDER BY users.id_users";
$users_set = mysql_query($getUsers);
while( $arrUsers = mysql_fetch_array($users_set)) {
$arrUserComp = $arrUsers;
}
ARRAY GENERATED BY THE SELECT QUERY
Array
(
[0] => Array
(
[0] => 1000001
[id_users] => 1000001
[1] => bharris
[username] => bharris
[2] => 5307584121
[acctno] => 5307584121
[3] => College Express
[acctname] => College Express
)
[1] => Array
(
[0] => 1000001
[id_users] => 1000001
[1] => bharris
[username] => bharris
[2] => 5307594121
[acctno] => 5307594121
[3] => Bill Payments
[acctname] => Bill Payments
)
[2] => Array
(
[0] => 1000003
[id_users] => 1000003
[1] => sfielden
[username] => sfielden
[2] => 506509878
[acctno] => 506509878
[3] => First Union
[acctname] => First Union
)
)
I WANT THE ARRAY TO LOOK LIKE THIS
Array
(
[0] => Array
(
[id_users] => user id for user 1
[username] => username
[acctno1] => account number 1
[acctname1] => name of account number 1
[last_bal1] => balance of account 1
[acctno2] => account number 2
[acctname2] => name of account number 2
[last_bal2] => balance of account 2
)
[1] => Array
(
[id_users] => user id for user 2
[username] => username
[acctno1] => account number 1
[acctname1] => name of account number 1
[last_bal1] => balance of account 1
)
)
The number of [acctno] and [acctname] elements is all dependent on the number of accounts the user has. How in the heck is this done?
Then I want to be able to print out the results in table that looks like this:
| username |
| account name | account number | balance |
| However many accounts there are. |
| username |
| account name | account number | balance |
| However many accounts there are. |
I hope you can help!!!!!