loadGangZone( gzid )
{
new query[256];
format(query, sizeof(query),"SELECT * FROM `gangzoneinfo` WHERE id=%d",gzid);
db_query(GangZonesDB, query);
// mysql_store_result();
if( mysql_num_rows() )
{
if(mysql_fetch_row(query,"|"))
{
printf("[GangZone] A gz [id%d] estб sendo carregada..." , gzid );
new field[7][25];
explode(query, field, "|");
// mysql_free_result();
db_free_result(query);
gangzoneInfo[gzid][gzId] = GangZoneCreate( floatstr(field[2]) , floatstr(field[3]) , floatstr(field[4]) , floatstr(field[5]) );
gangzoneInfo[gzid][gzName] = field[1];
gangzoneInfo[gzid][gzMinX] = floatstr( field[2] );
gangzoneInfo[gzid][gzMinY] = floatstr( field[3] );
gangzoneInfo[gzid][gzMaxX] = floatstr( field[4] );
gangzoneInfo[gzid][gzMaxY] = floatstr( field[5] );
gangzoneInfo[gzid][gzOwner] = strval( field[6] );
printf("[GangZone] A gz [id%d] foi carregada com os seguintes dados:" , gzid );
printf("[] ID: %d|Nome: %s|Owner: %d" , gangzoneInfo[gzid][gzId] , gangzoneInfo[gzid][gzName] , gangzoneInfo[gzid][gzOwner] );
printf("[] MinX: %f|MinY: %f|MaxX: %f|MaxY: %f|" , gangzoneInfo[gzid][gzMinX] , gangzoneInfo[gzid][gzMinY] , gangzoneInfo[gzid][gzMaxX] , gangzoneInfo[gzid][gzMaxY] );
printf("[GangZone] A gz [id%d] foi carregada por inteiro." , gzid );
}
}
}
mysql_store_result
if(mysql_fetch_row(query,"|"))
|
Hey Guys and Girls,
I would like to convert a mysql code into sqlite code but I don't know how to achieve this with the following code Код:
loadGangZone( gzid )
{
new query[256];
format(query, sizeof(query),"SELECT * FROM `gangzoneinfo` WHERE id=%d",gzid);
db_query(GangZonesDB, query);
// mysql_store_result();
if( mysql_num_rows() )
{
if(mysql_fetch_row(query,"|"))
{
printf("[GangZone] A gz [id%d] estб sendo carregada..." , gzid );
new field[7][25];
explode(query, field, "|");
// mysql_free_result();
db_free_result(query);
gangzoneInfo[gzid][gzId] = GangZoneCreate( floatstr(field[2]) , floatstr(field[3]) , floatstr(field[4]) , floatstr(field[5]) );
gangzoneInfo[gzid][gzName] = field[1];
gangzoneInfo[gzid][gzMinX] = floatstr( field[2] );
gangzoneInfo[gzid][gzMinY] = floatstr( field[3] );
gangzoneInfo[gzid][gzMaxX] = floatstr( field[4] );
gangzoneInfo[gzid][gzMaxY] = floatstr( field[5] );
gangzoneInfo[gzid][gzOwner] = strval( field[6] );
printf("[GangZone] A gz [id%d] foi carregada com os seguintes dados:" , gzid );
printf("[] ID: %d|Nome: %s|Owner: %d" , gangzoneInfo[gzid][gzId] , gangzoneInfo[gzid][gzName] , gangzoneInfo[gzid][gzOwner] );
printf("[] MinX: %f|MinY: %f|MaxX: %f|MaxY: %f|" , gangzoneInfo[gzid][gzMinX] , gangzoneInfo[gzid][gzMinY] , gangzoneInfo[gzid][gzMaxX] , gangzoneInfo[gzid][gzMaxY] );
printf("[GangZone] A gz [id%d] foi carregada por inteiro." , gzid );
}
}
}
mysql_free_result into db_free_result But I don't know how to handle the following codes: Код:
mysql_store_result Код:
if(mysql_fetch_row(query,"|")) Kind regards, Mike |
query = db_query(someDB, szQuery);
if(db_num_rows(query) > 0) {
SendClientMessage(playerid, 0, "There is more than 0 rows, meaning there is at least 1 row!");
SendClientMessage(playerid, 0, "So there is a registered account with my name!");
db_get_field_assoc(query, "Motto", szOut, sizeof(szOut));
SendClientMessage(playerid, 0, "Your motto is:");
SendClientMessage(playerid, 0, szOut);
db_free_result(query); // Clear the results saved in memory because we don't need them, they're in szOut
}
I already used the same post, but I was wondering if there was an easier way to replace some mysql functions. I got what I want now :P