BK201 Posted July 4, 2012 Share Posted July 4, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/265184-simple-select-all-question/ Share on other sites More sharing options...
kicken Posted July 4, 2012 Share Posted July 4, 2012 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 } Quote Link to comment https://forums.phpfreaks.com/topic/265184-simple-select-all-question/#findComment-1359053 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.