MySQL Help (Skype&TeamViewer Available) -
dillo1000 - 03.04.2014
I'm new to MySQL, My friends been helping me but he's been quite busy lately.
This isn't it all I just want to show the base of my problem and whether anyone would be able to help.
The organisations are not saving to the database.
+rep to whoever helps
Skype - Dillo1000
pawn Код:
#define MAX_ORGS 10
enum orginfo
{
Text3D:orglabel,
Color[11],
LName[24],
Member,
Wep1,
Wep2,
Wep3,
Skin1, //orgskin
Skin2, //orgskin
Lskin, //Leaderskin
OCol1,
OCol2,
Bank,
CP,
Float:CPX,
Float:CPY,
Float:CPZ,
Genre,//Law , Public Services or Gang.
Float:PX,
Float:PY,
Float:PZ,
Pickup,
Orgname[50],
Car1,
Car2,
Car3,
Car4,
Car5,
Car6,
Car7,
Car8,
Model1,
Model2,
Model3,
Model4,
Model5,
Model6,
Model7,
Model8,
Float:X1,
Float:X2,
Float:X3,
Float:X4,
Float:X5,
Float:X6,
Float:X7,
Float:X8,
Float:Y1,
Float:Y2,
Float:Y3,
Float:Y4,
Float:Y5,
Float:Y6,
Float:Y7,
Float:Y8,
Float:Z1,
Float:Z2,
Float:Z3,
Float:Z4,
Float:Z5,
Float:Z6,
Float:Z7,
Float:Z8,
Float:A1,
Float:A2,
Float:A3,
Float:A4,
Float:A5,
Float:A6,
Float:A7,
Float:A8,
};
new OrgInfo[MAX_ORGS][orginfo];
mysql_query("CREATE TABLE IF NOT EXISTS `orgs` (`Orgid`,`Name`,`Genre`,`Leader`,`Bank`,`Members`, `Hex`, `CPX`, `CPY`, `CPZ`,`Skin1`, `Skin2`, `Skin3`, `Wep1`, `Wep2`, `Wep3`, `Model1`, `Model2`, `Model3`, `Model4`, `Model5`, `Model6`,`Color1`, `Color2`, `Model7`, `Model8`, `X1`, `X2`, `X3`, `X4`, `X5`, `X6`, `X7`, `X8`, `Y1`,`Y2`,`Y3`,`Y4`,`Y5`,`Y6`,`Y7`,`Y8`,`Z1`,`Z2`,`Z3`,`Z4`,`Z5`,`Z6`,`Z7`,`Z8`,`A1`,`A2`,`A3`,`A4`,`A5`,`A6`,`A7`,`A8`)");
pawn Код:
stock LoadOrg()
{
new ocount;
for(new i=1; i<MAX_ORGS; i++)
{
format(query,sizeof(query),"SELECT * FROM `orgs` WHERE `Orgid` = '%d'",i);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
ocount ++;
mysql_fetch_row_format(drow, "|");
explode(drow, field, "|");
format(OrgInfo[i][Orgname],50,"%s",field[1]);
OrgInfo[i][Genre] = strval(field[2]);
format(OrgInfo[i][LName],24,"%s",field[3]);
OrgInfo[i][Member] = strval(field[4]);
OrgInfo[i][Skin1] = strval(field[5]);
OrgInfo[i][Skin2] = strval(field[6]);
OrgInfo[i][Lskin] = strval(field[7]);
OrgInfo[i][Wep1] = strval(field[8]);
OrgInfo[i][Wep2] = strval(field[9]);
OrgInfo[i][Wep3] = strval(field[10]);
format(OrgInfo[i][Color],11,"%s",field[11]);
OrgInfo[i][OCol1] = strval(field[12]);
OrgInfo[i][OCol2] = strval(field[13]);
OrgInfo[i][Bank] = strval(field[14]);
OrgInfo[i][CPX] = floatstr(field[15]);
OrgInfo[i][CPY] = floatstr(field[16]);
OrgInfo[i][CPZ] = floatstr(field[17]);
OrgInfo[i][PX] = floatstr(field[18]);
OrgInfo[i][PY] = floatstr(field[19]);
OrgInfo[i][PZ] = floatstr(field[20]);
OrgInfo[i][Model1] = strval(field[21]);
OrgInfo[i][Model2] = strval(field[22]);
OrgInfo[i][Model3] = strval(field[23]);
OrgInfo[i][Model4] = strval(field[24]);
OrgInfo[i][Model5] = strval(field[25]);
OrgInfo[i][Model6] = strval(field[26]);
OrgInfo[i][Model7] = strval(field[27]);
OrgInfo[i][Model8] = strval(field[28]);
OrgInfo[i][X1] = floatstr(field[29]);
OrgInfo[i][X2] = floatstr(field[30]);
OrgInfo[i][X3] = floatstr(field[31]);
OrgInfo[i][X4] = floatstr(field[32]);
OrgInfo[i][X5] = floatstr(field[33]);
OrgInfo[i][X6] = floatstr(field[34]);
OrgInfo[i][X7] = floatstr(field[35]);
OrgInfo[i][X8] = floatstr(field[36]);
OrgInfo[i][Y1] = floatstr(field[37]);
OrgInfo[i][Y2] = floatstr(field[38]);
OrgInfo[i][Y3] = floatstr(field[39]);
OrgInfo[i][Y4] = floatstr(field[40]);
OrgInfo[i][Y5] = floatstr(field[41]);
OrgInfo[i][Y6] = floatstr(field[42]);
OrgInfo[i][Y7] = floatstr(field[43]);
OrgInfo[i][Y8] = floatstr(field[44]);
OrgInfo[i][Z1] = floatstr(field[45]);
OrgInfo[i][Z2] = floatstr(field[46]);
OrgInfo[i][Z3] = floatstr(field[47]);
OrgInfo[i][Z4] = floatstr(field[48]);
OrgInfo[i][Z5] = floatstr(field[49]);
OrgInfo[i][Z6] = floatstr(field[50]);
OrgInfo[i][Z7] = floatstr(field[51]);
OrgInfo[i][Z8] = floatstr(field[52]);
OrgInfo[i][A1] = floatstr(field[53]);
OrgInfo[i][A2] = floatstr(field[54]);
OrgInfo[i][A3] = floatstr(field[55]);
OrgInfo[i][A4] = floatstr(field[56]);
OrgInfo[i][A5] = floatstr(field[57]);
OrgInfo[i][A6] = floatstr(field[58]);
OrgInfo[i][A7] = floatstr(field[59]);
OrgInfo[i][A8] = floatstr(field[60]);
OrgInfo[i][Car1] = CreateVehicle(OrgInfo[i][Model1],OrgInfo[i][X1],OrgInfo[i][Y1],OrgInfo[i][Z1],OrgInfo[i][A1],OrgInfo[i][OCol1],OrgInfo[i][OCol2],-1);
OrgInfo[i][Car2] = CreateVehicle(OrgInfo[i][Model2],OrgInfo[i][X2],OrgInfo[i][Y2],OrgInfo[i][Z2],OrgInfo[i][A2],OrgInfo[i][OCol1],OrgInfo[i][OCol2],-1);
OrgInfo[i][Car3] = CreateVehicle(OrgInfo[i][Model3],OrgInfo[i][X3],OrgInfo[i][Y3],OrgInfo[i][Z3],OrgInfo[i][A3],OrgInfo[i][OCol1],OrgInfo[i][OCol2],-1);
OrgInfo[i][Car4] = CreateVehicle(OrgInfo[i][Model4],OrgInfo[i][X4],OrgInfo[i][Y4],OrgInfo[i][Z4],OrgInfo[i][A4],OrgInfo[i][OCol1],OrgInfo[i][OCol2],-1);
OrgInfo[i][Car5] = CreateVehicle(OrgInfo[i][Model5],OrgInfo[i][X5],OrgInfo[i][Y5],OrgInfo[i][Z5],OrgInfo[i][A5],OrgInfo[i][OCol1],OrgInfo[i][OCol2],-1);
OrgInfo[i][Car6] = CreateVehicle(OrgInfo[i][Model6],OrgInfo[i][X6],OrgInfo[i][Y6],OrgInfo[i][Z6],OrgInfo[i][A6],OrgInfo[i][OCol1],OrgInfo[i][OCol2],-1);
OrgInfo[i][Car7] = CreateVehicle(OrgInfo[i][Model7],OrgInfo[i][X7],OrgInfo[i][Y7],OrgInfo[i][Z7],OrgInfo[i][A7],OrgInfo[i][OCol1],OrgInfo[i][OCol2],-1);
OrgInfo[i][Car8] = CreateVehicle(OrgInfo[i][Model8],OrgInfo[i][X8],OrgInfo[i][Y8],OrgInfo[i][Z8],OrgInfo[i][A8],OrgInfo[i][OCol1],OrgInfo[i][OCol2],-1);
OrgInfo[i][CP] = CreateDynamicCP(OrgInfo[i][CPX],OrgInfo[i][CPY],OrgInfo[i][CPZ],1,-1,-1,-1,100.0);
OrgInfo[i][Pickup] = CreateDynamicPickup(1242,2,OrgInfo[i][PX],OrgInfo[i][PY],OrgInfo[i][PZ],-1,-1,-1,100.0);
OrgInfo[i][orglabel] = CreateDynamic3DTextLabel(OrgInfo[i][Orgname],-1,OrgInfo[i][CPX],OrgInfo[i][CPY],OrgInfo[i][CPZ],15,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,-1,-1,-1,15);
mysql_free_result();
}
}
return printf("%d orgs loaded",ocount);
}
MySQL (PHPMyAdmin)
Код:
CREATE TABLE IF NOT EXISTS `orgs` (
`Orgname` text NOT NULL,
`Genre` int(11) NOT NULL,
`LName` text NOT NULL,
`Member` int(11) NOT NULL,
`Skin1` int(11) NOT NULL,
`Skin2` int(11) NOT NULL,
`Lskin` int(11) NOT NULL,
`Wep1` int(11) NOT NULL,
`Wep2` int(11) NOT NULL,
`Wep3` int(11) NOT NULL,
`Color` text NOT NULL,
`OCol1` int(11) NOT NULL,
`OCol2` int(11) NOT NULL,
`Bank` int(11) NOT NULL,
`CPX` float NOT NULL,
`CPY` float NOT NULL,
`CPZ` float NOT NULL,
`PX` float NOT NULL,
`PY` float NOT NULL,
`PZ` float NOT NULL,
`Model1` int(11) NOT NULL,
`Model2` int(11) NOT NULL,
`Model3` int(11) NOT NULL,
`Model4` int(11) NOT NULL,
`Model5` int(11) NOT NULL,
`Model6` int(11) NOT NULL,
`Model7` int(11) NOT NULL,
`Model8` int(11) NOT NULL,
`X1` float NOT NULL,
`X2` float NOT NULL,
`X3` float NOT NULL,
`X4` float NOT NULL,
`X5` float NOT NULL,
`X6` float NOT NULL,
`X7` float NOT NULL,
`X8` float NOT NULL,
`Y1` float NOT NULL,
`Y2` float NOT NULL,
`Y3` float NOT NULL,
`Y4` float NOT NULL,
`Y5` float NOT NULL,
`Y6` float NOT NULL,
`Y7` float NOT NULL,
`Y8` float NOT NULL,
`Z1` float NOT NULL,
`Z2` float NOT NULL,
`Z3` float NOT NULL,
`Z4` float NOT NULL,
`Z5` float NOT NULL,
`Z6` float NOT NULL,
`Z7` float NOT NULL,
`Z8` float NOT NULL,
`A1` float NOT NULL,
`A2` float NOT NULL,
`A3` float NOT NULL,
`A4` float NOT NULL,
`A5` float NOT NULL,
`A6` float NOT NULL,
`A7` float NOT NULL,
`A8` float NOT NULL
Re: MySQL Help (Skype&TeamViewer Available) -
RenovanZ - 03.04.2014
Have you insert your data to the database ?
Код:
INSERT INTO `tables` (`field1`, `field1`) VALUES ('data1', 'data1')
Re: MySQL Help (Fixed) -
dillo1000 - 03.04.2014
Fixed NVM