SQL Help Please
#1

So hear is the long story:
I have created a dynamic system for individual races for a server I am working on. I can get it to save the toptimes into the table, but when I got to load the toptimes for a bump when it is created upon server start it will load the toptimes for the first bump not the ones that follow. it's got me completely stumped. I am still a nab in SQL so it has to be something there.


In the above image it shows the console with the Queries being executed, and the data returned. The first When bump ID 0 loads and send the appropriate query it gets the correct data. But when Bump ID 1 is created and it sends its query it gets nothing in return. I am using BlueG's SQL plugin, R30 something.

Here is the pawn code that I am using for the SQL, but I feel it may be a limitation to SQL or my syntax. I am not 100% sure why it is happening. It seems that it should be just fine.

pawn Код:
new query[500], data[23], cnt = 0;
mysql_format(sqlConnection, query, sizeof(query), "SELECT * FROM `bump` WHERE `bumpID`='%d' ORDER BY `toptime` ASC LIMIT 0,10;", bumpID);

new Cache:result = mysql_query(sqlConnection, query);
print("------------------------------------");
print(query);
printf("Bump ID: %d", bumpID);
while(mysql_retrieve_row())
{
    cache_get_field_content(cnt, "name", BumpTTN[bumpID][cnt]);
    cache_get_field_content(cnt, "toptime", data);
    BumpTTT[bumpID][cnt] = strval(data);
    printf("%d -> %s : %d", cnt, BumpTTN[bumpID][cnt], BumpTTT[bumpID][cnt]);
    cnt++;
}
cache_delete(result);
print("------------------------------------");
Sql test data that I am using


Anyways I have been beating my head against the wall using ******, trying to find someone with a similar issue, reading wikis for SQL, and BlueG's plugin for the past week. I am pretty stumped. I don't need you to write out an entire solution, I am not dull minded. But even telling me I am restarted for doing something, and at least pointing me in the correct direction would be very helpful.
Reply
#2

Corrected. Had a moment of random thoughts that lead me to the answer after almost a week of banging my head against the wall.

Using the wrong function of mysql_retrieve_row(); Instead used cache_get_row_count() than ran a forloop. Corrected my issue. Had me flustered for a while. Also moved it back to its threaded function. Everything works normally!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)