PDA

View Full Version : mysql transfering


Jimmi
26/07/2015, 12:17 AM
Look this up on the r39-3?

public LoadBizz()
{
new biss;
new result[100],index = 0;
new query[256];
format(query, sizeof(query), "SELECT * FROM `bizz` ORDER BY `bizz`.`ID` ASC");
mysql_query(query);
mysql_store_result();
while(mysql_retrieve_row())
{
biss++;
index++;
new i = index;
mysql_get_field("Owned", result); BizzInfo[i][bOwned] = strval(result);
mysql_get_field("Owner", result); strmid(BizzInfo[i][bOwner], result, 0, 32, 32);
mysql_get_field("Message", result); strmid(BizzInfo[i][bMessage], result, 0, 60, 60);
mysql_get_field("Extortion", result); strmid(BizzInfo[i][bExtortion], result, 0, 32, 32);
mysql_get_field("EntX", result); BizzInfo[i][bEntranceX] = floatstr(result);
mysql_get_field("EntY", result); BizzInfo[i][bEntranceY] = floatstr(result);
mysql_get_field("EntZ", result); BizzInfo[i][bEntranceZ] = floatstr(result);
mysql_get_field("ExitX", result); BizzInfo[i][bExitX] = floatstr(result);
mysql_get_field("ExitY", result); BizzInfo[i][bExitY] = floatstr(result);
mysql_get_field("ExitZ", result); BizzInfo[i][bExitZ] = floatstr(result);
mysql_get_field("Level", result); BizzInfo[i][bLevelNeeded] = strval(result);
mysql_get_field("Price", result); BizzInfo[i][bBuyPrice] = strval(result);
mysql_get_field("EPrice", result); BizzInfo[i][bEntranceCost] = strval(result);
mysql_get_field("Till", result); BizzInfo[i][bTill] = strval(result);
mysql_get_field("Locked", result); BizzInfo[i][bLocked] = strval(result);
mysql_get_field("Interior", result); BizzInfo[i][bInterior] = strval(result);
mysql_get_field("Products", result); BizzInfo[i][bProducts] = strval(result);
mysql_get_field("MaxProducts", result); BizzInfo[i][bMaxProducts] = strval(result);
mysql_get_field("ProductPrice", result); BizzInfo[i][bPriceProd] = strval(result);
}
mysql_free_result();
printf("[BIZZ]Au fost incarcate %d bizz-uri.Felicitari pentru reusita.[PG-ZONE.RO]", index);
return 1;
}

kloning1
26/07/2015, 08:15 AM
look at here
http://wiki.sa-mp.com/wiki/MySQL/R33

xVIP3Rx
26/07/2015, 10:05 AM
Read some tutorials and it should be something like this

new Handle;
new Cache:result;

public OnGameModeInit()
{
Handle = mysql_connect(HOST,USER,DATABASE,PASS);
return 1;
}

public LoadBizz()
{
new i, query[256];

mysql_format(Handle, query, sizeof(query), "SELECT * FROM `bizz` ORDER BY `bizz`.`ID` ASC");
result = mysql_query(Handle, query);

while(cache_get_row_count(Handle))
{
i++;

BizzInfo[i][bOwned] = cache_get_field_content_int(i, "Owned");

cache_get_field_content(i, "Owner", BizzInfo[i][bOwner]);
cache_get_field_content(i, "Message", BizzInfo[i][bMessage]);
cache_get_field_content(i, "Extortion", BizzInfo[i][bExtortion]);

BizzInfo[i][bEntranceX] = cache_get_field_content_float (i, "EntX");
BizzInfo[i][bEntranceY] = cache_get_field_content_float (i, "EntY");
BizzInfo[i][bEntranceZ] = cache_get_field_content_float (i, "EntZ");
BizzInfo[i][bExitX] = cache_get_field_content_float (i, "ExitX");
BizzInfo[i][bExitY] = cache_get_field_content_float (i, "ExitY");
BizzInfo[i][bExitZ] = cache_get_field_content_float (i, "ExitZ");

BizzInfo[i][bLevelNeeded] = cache_get_field_content_int(i, "Level");
BizzInfo[i][bBuyPrice] = cache_get_field_content_int(i, "Price");
BizzInfo[i][bEntranceCost] = cache_get_field_content_int(i, "EPrice");
BizzInfo[i][bTill] = cache_get_field_content_int(i, "Till");
BizzInfo[i][bLocked] = cache_get_field_content_int(i, "Locked");
BizzInfo[i][bInterior] = cache_get_field_content_int(i, "Interior");
BizzInfo[i][bProducts] = cache_get_field_content_int(i, "Products");
BizzInfo[i][bMaxProducts] = cache_get_field_content_int(i, "MaxProducts");
BizzInfo[i][bPriceProd] = cache_get_field_content_int(i, "ProductPrice");
}
cache_delete(Handle);

printf("[BIZZ]Au fost incarcate %d bizz-uri.Felicitari pentru reusita.[PG-ZONE.RO]", index);
return 1;
}

Jimmi
26/07/2015, 03:44 PM
It gives me errors that have no connection with a mysql
C:\Users\Jimmi\Desktop\93.119.25.182-7777\pawno\include\EVF.inc(814) : error 017: undefined symbol "EVF_OnPlayerUpdate"
C:\Users\Jimmi\Desktop\93.119.25.182-7777\pawno\include\EVF.inc(839) : error 017: undefined symbol "EVF_OnVehicleRespray"
C:\Users\Jimmi\Desktop\93.119.25.182-7777\pawno\include\EVF.inc(850) : error 017: undefined symbol "EVF_OnVehiclePaintjob"
../include/gl_common.inc(83) : warning 219: local variable "result" shadows a variable at a preceding level
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(955) : error 004: function "OOCNews" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(1793) : error 017: undefined symbol "GetPlayerCash"
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(1794) : error 017: undefined symbol "SetPlayerCash"
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3381) : error 004: function "split" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3791) : error 004: function "SetPlayerToTeamColor" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3816) : error 004: function "SetPlayerToTeamColor" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3860) : error 017: undefined symbol "strmatch"
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3868) : error 017: undefined symbol "strmatch"
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3939) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3943) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3955) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3959) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3963) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3967) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3971) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3975) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3979) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3983) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3987) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(3999) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(4003) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(4007) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Jimmi\Desktop\93.119.25.182-7777\gamemodes\RunStrike.pwn(4011) : error 004: function "PlayerToPoint" is not implemented

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


26 Errors.