27.05.2011, 20:12
Hi. I need some help with my SQL code... Im trying to get the last ID that was inserted in my database. It seems like the code Im using only counts the first 10 records.. I dont really know why. Maybe somebody knows why? I made 2 diffrent functions they both outputs the value: 9 (witch is the first 10 records in my database.) Somehow the code work if there is less then 10 records but not if there is more.. (This happens to both my functions) Did I do something wrong?
Simple version:
Simple version:
pawn Код:
stock GetLastIDSimple()
{
new DBResult:qresult, string[128];
qresult = db_query(GPSDB,"SELECT * FROM `System` ORDER BY `ID` DESC LIMIT 1");
db_get_field(qresult,0,string,128);
printf("Output %d", strval(string));
db_free_result(qresult);
return 1;
}