Here's the situation - Im making a website for a game server in which a user can make 1 account. and in 1 account he can make 3 characters. We maintain two tables one for accounts and one for characters.
The three characters which can be made is recognized by the accountid of the account.
Now the problem is if I execute this query:

$set = mysql_query("SELECT * FROM `characters` WHERE `accountid` = '" . $row['id'] . "'");

and if the user has 3 characters, mysql_num_rows will be 3.Now how do i put each row i get into one array using

$row = mysql_fetch_array($set);

Thank you for your answers

You can use a While statement to do this:

while($row=mysql_fetch_array($set)) {
  //Processing of the returned row
}

This will loop through the same amount of times as rows returned and the code will be run (in this case, 3 times).

commented: Good, concise answer +3

hey yea .. that works...
i played alot with if and for
but that didnt work.. Thanks alot :)

thanksalot .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.