MySQL free ID
#1

Hello, I'm trying to combine two tables in MySQL.

Code:

Код:
new query[400];
mysql_format(handle, query, sizeof(query), "INSERT INTO Phones SET Number = '%i'", phone);
mysql_tquery(handle, query, "", ""); // Tried InsertPhone here but same result
InsertPhone(number, cache_insert_id());

public InsertPhone(number, lastid)
{
new query[400];
mysql_format(handle, query, sizeof(query), "INSERT INTO ServerObjects (number, phoneid) VALUES ('%i', '%d')", number, lastid);
mysql_query(handle, query);
}
But the last id is 0 everytime. In the table Phones I have an ID row with AUTO_INCREMENT.
In Server I can't make the 'phoneid' as AUTO_INCREMENT because I don't insert only phones...

Any help?
Reply


Messages In This Thread
MySQL free ID - by HidroDF - 17.12.2016, 22:05
Re: MySQL free ID - by SickAttack - 17.12.2016, 22:08
Respuesta: MySQL free ID - by HidroDF - 17.12.2016, 22:09
Re: Respuesta: MySQL free ID - by SickAttack - 17.12.2016, 22:10
Respuesta: MySQL free ID - by HidroDF - 17.12.2016, 22:15

Forum Jump:


Users browsing this thread: 1 Guest(s)