SA-MP Forums Archive
mysql help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: mysql help (/showthread.php?tid=189559)



mysql help - armyoftwo - 12.11.2010

The field is auto_increment and PRIMARY.
As you can see that it inserts the new field in wrong order..
like ( see picture )

40
39
38
37
41
42
43
44
45
46
47

how can i fix that?


Re: mysql help - TheXIII - 12.11.2010

Err.. just click on the "SQLID", so it will sort it by that?


Re: mysql help - armyoftwo - 12.11.2010

Quote:
Originally Posted by TheXIII
Посмотреть сообщение
Err.. just click on the "SQLID", so it will sort it by that?
you miss understood

i use this code:
Код:
    format(string, sizeof(string), "INSERT INTO business_products (BSQLID, ProductName, Stock, SellPrice) VALUES('%i', '%s', '%i', '%i')",
        OrderInfo[playerid][OrderDestID], GetProductName(OrderInfo[playerid][OrderID]), OrderInfo[playerid][OrderAmount] + ProductAmount, 9999999);
    mysql_query(string);
    mysql_query("SELECT MAX(SQLID) FROM business_products");
It inserts in the next sqlid, not in a free sqlid.


Re: mysql help - Sub Z3rO - 12.11.2010

I dont undestand why you are quering it two times lol


Re: mysql help - armyoftwo - 12.11.2010

Quote:
Originally Posted by Sub Z3rO
Посмотреть сообщение
I dont undestand why you are quering it two times lol
didnt notice that ,but i'm not here to discuss how i script okay? It's my own business how i script


Re: mysql help - TheXIII - 12.11.2010

pawn Код:
format(string, sizeof(string), "INSERT INTO business_products (ProductName, Stock, SellPrice) VALUES('%s', '%i', '%i')",
        OrderInfo[playerid][OrderDestID], GetProductName(OrderInfo[playerid][OrderID]), OrderInfo[playerid][OrderAmount] + ProductAmount, 9999999);
    mysql_query(string);
    new ReturnedSQLID = mysql_insert_id();



Re: mysql help - Cameltoe - 12.11.2010

Thats just the way mysql AI works, if you want it ordered after deleting a row or two.. you have to delete ID and recreate it.