I currently have a buddy system that requires a lot of queries and has a lot of users. My method of searching for a specific user worked for a while until the amount of entries started to get into the 10s of thousands. The way I currently search for a user is like this:
$results = mysql_query("SELECT * FROM Info");
while($row = mysql_fetch_array($results)){
$ignFromDB = $row['IGN'];
if($ignFromDB == $ign){
$friendsFromDB = $row['Friends'];
$frArr = explode(':', $friendsFromDB);
return $frArr;
}
}
Since I now need to search through 10s of thousands of entries it becomes a very inefficient and slow approach. As a way of solving this I decided to only have one search request per user: At startup they would request their entry index and then would send a request with that index so I wouldn't need to loop. I could just select the entry with that index. Only problem is I have very little knowledge of MySQL and I need to know how to do this. Any help would be greatly appreciated!