Hey there guys, I'm trying to select all the rows where a certain ID is: the problem is the query is only returning the first row with the ID. Kinda clueless here, would appreciate any help.
"SELECT * FROM players WHERE acc_id = '$acc_id'";
Using mysql_fetch_array() , I only have the first listed row with the account ID in the array but there is about 5 in the table.
It's selecting all the data from that first row, and I'm guessing that I'm using the wrong query, I'd really like to avoid writing a loop to go through all these queries as I'm sure there is a way to do it with just a single query.
mysql_fetch_array only returns one row. You need to call it multiple times to get the rest of the rows. This is typically done with a while loop:
while ($row=mysql_fetch_array($res)){
//do something
}