Count ID's in SQL
#1

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:
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;
}
Reply


Messages In This Thread
Count ID's in SQL - by Fj0rtizFredde - 27.05.2011, 20:12
Re: Count ID's in SQL - by Fj0rtizFredde - 28.05.2011, 13:16
Re: Count ID's in SQL - by Haydz - 28.05.2011, 13:24
Re: Count ID's in SQL - by Fj0rtizFredde - 28.05.2011, 14:36
Re: Count ID's in SQL - by Fj0rtizFredde - 29.05.2011, 17:53
Re: Count ID's in SQL - by Fj0rtizFredde - 29.05.2011, 19:41
Re: Count ID's in SQL - by Fj0rtizFredde - 29.05.2011, 20:10

Forum Jump:


Users browsing this thread: 1 Guest(s)