Trying to do something pretty funky here, making small amounts of headway and looking for a way of doing this. This is all just testing right now, so I will clean it up before I am completely done. Since I do not know jack about C++, this is 'train as you go'.
Running this query returns 1276 results, but only the id column. I am sure the result amount will be less when I am done. Anyway I want to dump these 1276 results into I guess an array, then run the random number generator on it. I thought about doing the random row thing with MySQL but everyone says that is crap and takes way too long. I figured the best way then would be to get back a small amount of results and let C++ do a random number pull on it. Anyway I do not know jack about arrays in C++, this would be super easy with C# so I am struggling. I want to take the results and put them into something, and then pull a single random and return that item's id.
Code:
if(database.RunQuery(query, MakeAnyLenString(&query,"select `id` from `items` WHERE `classes`= '%i'", class_id), errbuf, &result))
{
while((row = mysql_fetch_row(result)))
{
int32 result=0;
// take result from mysql and pull random number
return result;
}
mysql_free_result(result);
}