Help with MySQL
#1

Yeah, hello. Im kinda tryin to make buisiness system which would be with MySQL, and when I trying to load my records I usually get errors, please, help me how to properly load my buisiness.
Here's where I load.
Код:
stock loadBizz()
{
    new
		            szReturn[128];
    for(new i=0;i<MAX_BUISINESS;i++)
    {
		new zinute[144];
		new kaina;
	    mysql_fetch_field_row(szReturn, "kaina", IconnectionHandle);
	    bData[i][bKaina]= strval(szReturn);
	    mysql_fetch_field_row(szReturn, "ID", connectionHandle);
	    bData[i][bID] = strval(szReturn);
	    mysql_fetch_field_row(szReturn, "PosX", connectionHandle);
	    bData[i][bPos[0]] = strval(szReturn);
	    mysql_fetch_field_row(szReturn, "PosY", connectionHandle);
	    bData[i][bPos[1]] = strval(szReturn);
	    mysql_fetch_field_row(szReturn, "PosZ", connectionHandle);
	    bData[i][bPos[2]] = strval(szReturn);
	    mysql_fetch_field_row(szReturn, "kaina", connectionHandle);
	    bData[i][kaina] = strval(szReturn);
	    format(zinute,144,"{22F107}BIZNIS PARDUODAMAS\n{FFFFFF}Kaina: %i\n{22F107}/bpirkti",kaina);
	    CreatePickup(1239, 1, bData[i][bPos[0]],bData[i][bPos[1]],bData[i][bPos[2]], -1);
	    Create3DTextLabel(zinute,-1,bData[i][bPos[0]],bData[i][bPos[1]],bData[i][bPos[2]],40.0,0,1);
    }
    return 1;
}
And here's where I create my buisiness:
Код:
CMD:biznis(playerid,params[])
{
	if(pData[playerid][pAdmin] < 5) return ErrorMsg(playerid,"neturi teisлs naudotis рia komanda.");
	else
	{
	    new interior;
	    new kaina;
        if (sscanf(params, "ui", interior, kaina))
		{
    		return WarnMsg(playerid,"/biznis <interjeroid> <kaina>");
		}
		new Float:bizPos[3];
		new zinute[144];
		new szQuery[256];
		new virtualworld = GetPlayerVirtualWorld(playerid);
		GetPlayerPos(playerid,bizPos[0],bizPos[1],bizPos[2]);
		format(zinute,144,"{22F107}BIZNIS PARDUODAMAS\n{FFFFFF}Kaina: %i\n{22F107}/bpirkti",kaina);
		Create3DTextLabel(zinute,-1,bizPos[0],bizPos[1],bizPos[2],40.0,virtualworld,1);
	 	CreatePickup(1239, 1, bizPos[0],bizPos[1],bizPos[2], -1);
		format(szQuery, sizeof(szQuery), "INSERT INTO bizniai (ID,kaina,PosX,PosY,PosZ) VALUES ('%i','%i', '%f','%f','%f')",mysql_insert_id(iConnectionHandle)+1,kaina,bizPos[0],bizPos[1],bizPos[2]);
		
		mysql_query(szQuery, THREAD_CREATE_BIZ, playerid, iConnectionHandle);
	}
	return 1;
}
Reply
#2

Which MySQL plugin are you using? Make sure the one that you're using is the one that your script is using.
Reply
#3

Im using Mysql R7 Blueg, yeah.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)