06.10.2013, 20:33
Hi there, I've a little problem loading some stuff from the MySQL database with sscanf. Here's the enum:
And here's the loading function:
Here's what appears on the debug.txt too:
That's all in the debug.txt, nothing else appears. If anyone could help me with this problem, that'd be good.
pawn Code:
enum fData
{
fMySQLID,
fID,
fName[50],
fMOTD[250],
fLeader[40],
fType,
fRank1Name[50],
fRank2Name[50],
fRank3Name[50],
fRank4Name[50],
fRank5Name[50],
fRank6Name[50],
fRank7Name[50],
fMaterials,
fDrugs,
fSafe,
fHQLock,
fMembers,
fSlots,
Float:fExteriorX,
Float:fExteriorY,
Float:fExteriorZ,
Float:fExteriorF,
Float:fInteriorX,
Float:fInteriorY,
Float:fInteriorZ,
Float:fInteriorF,
fInterior,
fWorld,
};
new FactionData[MAX_FACTIONS][fData];
new Text3D:FactionLabel[MAX_FACTIONS];
pawn Code:
public LoadFactions()
{
new f = 0;
mysql_query("SELECT * FROM `rp_factions`");
mysql_store_result();
factions = mysql_num_rows();
for(new idx = 1; idx <= factions; idx++)
{
format(query, sizeof(query), "SELECT * FROM `rp_factions` WHERE `faction_id`='%d'", idx);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
{
while(mysql_fetch_row_format(query, "|"))
{
print("step 1 done"); // this appears
sscanf(query, "p<|>e<dds[50]s[250]s[40]ds[50]s[50]s[50]s[50]s[50]s[50]s[50]ddddddffffffffdd>", FactionData[idx]);
print("step 2 done"); // this doesn't, so there's some problem above step 2 and below step 1
f++;
}
}
}
printf("- Factions: %d", f); // nor does this appear, so everything stops after the sscanf query
return 1;
}
Quote:
[21:36:27] --------------------------- [21:36:27] MySQL Debugging activated (10/06/13) [21:36:27] --------------------------- [21:36:27] [21:36:27] >> mysql_ping( Connection handle: 1 ) [21:36:27] CMySQLHandler::Ping() - Connection is still alive. [21:36:27] >> mysql_query( Connection handle: 1 ) [21:36:27] CMySQLHandler::Query(SELECT * FROM `rp_factions`) - Successfully executed. [21:36:27] >> mysql_store_result( Connection handle: 1 ) [21:36:27] CMySQLHandler::StoreResult() - Result was stored. [21:36:27] >> mysql_num_rows( Connection handle: 1 ) [21:36:27] CMySQLHandler::NumRows() - Returned 1 row(s) [21:36:27] >> mysql_query( Connection handle: 1 ) [21:36:27] CMySQLHandler::Query(SELECT * FROM `rp_factions` WHERE `faction_id`='1') - Successfully executed. [21:36:27] >> mysql_store_result( Connection handle: 1 ) [21:36:27] CMySQLHandler::StoreResult() - Result was stored. [21:36:27] >> mysql_num_rows( Connection handle: 1 ) [21:36:27] CMySQLHandler::NumRows() - Returned 1 row(s) [21:36:27] >> mysql_fetch_row_format( Connection handle: 1 ) [21:36:27] CMySQLHandler::FetchRow() - Return: 1|1|testname|test|testusername|1|test1|test2|test3 |test4|test5|test6|test7|0|0|0|1|1|20|187.8615|193 1.5109|17.6864|0|187.8615|187.8615|187.8615|187.86 15|0|0 |