Not getting value from MySQL Database
#2

BizID column must be set as AUTO INCREMENT. After an INSERT query, there is a function called cache_insert_id which retrieves the value generated by AI column.

Your code executes a non-threaded query and you will need to free the memory if you are going to retrieve:
pawn Код:
new Cache: cache_id = mysql_query(Database, query);

bInfo[id][BizID] = cache_insert_id();

cache_delete(cache_id);
to avoid memory leak.

Why do you not use threaded queries? It is advised to, most of the times.
pawn Код:
mysql_tquery(Database, query, "OnBusinessCreate", "d", id);
// pass `playerid` if you send message to the creator of the business
pawn Код:
forward OnBusinessCreate(business_id);
public OnBusinessCreate(business_id)
{
    bInfo[business_id][BizID] = cache_insert_id();
}
Reply


Messages In This Thread
Not getting value from MySQL Database - by NoteND - 25.09.2018, 08:16
Re: Not getting value from MySQL Database - by Calisthenics - 25.09.2018, 08:41

Forum Jump:


Users browsing this thread: 3 Guest(s)