16.02.2013, 07:27
Hello
I got one problem - I can't select field with SUM or AVG from my sqlite database. Function "db_get_field" simply crashes (yes, i debugged it with print).
My code:
When there isn't any rows, "numRows" still is bigger than 0, and server crashes at db_get_field.
Thanks for any help!
I got one problem - I can't select field with SUM or AVG from my sqlite database. Function "db_get_field" simply crashes (yes, i debugged it with print).
My code:
Код:
new query[128], rating[10];
formatt(query, "SELECT AVG(Rate) FROM `raceratings` WHERE `RaceID`='%d'", raceid);
new DBResult:rateCheck = db_query(servDB, query);
new numRows = db_num_rows(rateCheck);
if(numRows > 0)
{
db_get_field(rateCheck, 0, rating, sizeof(rating));
avg = floatstr(rating);
}
else
avg = 0.0;
db_free_result(rateCheck);
Thanks for any help!

