Problem about id order mysql
#1

How can i get the last id ... to make them 1, 2 , 3 , 4




My code

pawn Код:
format(szQuery, 500, "INSERT INTO `accounts` (Name,Password) VALUES ('%s','%s')", GetName(playerid), PasswordInserted[playerid]);
            mysql_tquery(SQL, szQuery, "", "");
Reply
#2

If you want to get the ID when you instered new row, use mysql_insert_id.
Use it after query, this function gets LAST inserted AI id.
Reply
#3

I don't know how to use it..
Reply
#4

My code example.

Quote:

format(string, sizeof(string), "INSERT INTO `furniture` (`ID`) VALUES(%d)", HouseInfo[houseid][id]);
mysql_query(string);
OnFurnitureCreated(idz);

And OnFurnitureCreated runs.

Quote:

forward OnFurnitureCreated(furnitureid);
public OnFurnitureCreated(furnitureid)
{
FurnitureData[furnitureid][furnitureID] = mysql_insert_id();
Furniture_Save(furnitureid);
return 1;
}

Reply
#5

when i' using mysql_insert_id = i get error which one said don't exist the param..


and if i use cache_insert_id = i get in mysql_log "no active cache"
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)