0

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

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by RuneMan
1

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).

Votes + Comments
Good, concise answer
0

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

thanksalot .

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.