I am having a little bit of a problem with the mysql_fetch_array function.
What I am trying to do is retrieve the user id (id_users) and username (username) from a table.
Based on that data I need to select some data from another table with the the id user (id_users) number. I can only do that once because it only searches the table based upon the first user number.
// Connection assumed present
// id_household = 1000001
$getUsers = "SELECT id_users,username FROM users
WHERE id_household = '$id_household'";
$users = mysql_query($getUsers);
$num_users = mysql_num_rows($users);
$row_users = mysql_fetch_array($users);
That code above will return 2 records (as of now).
id_users = 1000002 ..... username = bharris
id_users = 1000003 ..... username = sfielden
I need to take those values and setup them equal to separate variables or store them in an array (id_users and usernames).
Next I need to connect to a different table - accounts. With each of those id numbers return an account number (acctnum)
If I did a separate search with each they would return 1 account (as of now). And set an array with the username and related account numbers.
Maybe using a multidimensional array would make sense:
[id_users][username][accounts]
I hope you can help????