22.05.2014, 12:10
Hey. So basically my problem is that whenever I insert something in the database it returns ID 0 until I restart the server. Look here :
This is the log.
Any ideas why it keeps returning 0 instead of the actual ID ? The table has auto_increment.
I also tried with cache_insert_id(dbHandle), same result.
pawn Код:
mysql_format(dbHandle, query, sizeof(query), "INSERT INTO `furnitures` (model, name, houseid, interior, virworld, marketprice, posx, posy, posz) VALUES (%d, '%s', %d, %d, %d, %d, %f, %f, %f)",
model, name, HouseInfo[houseid][hID], interior, world, price, x, y ,z);
mysql_tquery(dbHandle, query);
printf("Furniture inserted with ID : %d", cache_insert_id());
PHP код:
[15:24:05] INSERT INTO `furnitures` (model, name, houseid, interior, virworld, marketprice, posx, posy, posz) VALUES (1369, 'Wheelchair', 169, 10, 149, 500, 388.019226, 1506.852173, 1080.092529)
[15:24:05] Furniture inserted with ID : 0
I also tried with cache_insert_id(dbHandle), same result.

