mysql help
#1

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?
Reply
#2

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

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.
Reply
#4

I dont undestand why you are quering it two times lol
Reply
#5

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
Reply
#6

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();
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)