25.02.2013, 23:22
So I tried to make something that would fetch all groups and load them, however it does not.
It does not throw any errors with this either btw. It just doesnt load them.
Any reason this is so?
And yes this is a edit of my player loading system that does work right.
It does not throw any errors with this either btw. It just doesnt load them.
Any reason this is so?
pawn Код:
stock loadGroups()
{
new groupQuery[400];
format(groupQuery, sizeof(groupQuery), "SELECT * FROM `groups`"); //Format the query, insert the information in again
mysql_query(groupQuery); //Run the query
mysql_store_result(); //Store the result
new fetchVal[100]; //A array to hold the data were going to get
while(mysql_fetch_row(groupQuery, "|")) //Loop through the columns
{
for(new xf = 0; xf < MAX_GROUPS; xf++)
{
mysql_fetch_field("GroupID", fetchVal); //Fetch data from the column 'pAdmin' and save it to 'fetchVal'
GroupInfo[xf][GroupID] = strval(fetchVal); //Set the variable equal to value of the fetch.
mysql_fetch_field("GroupName", fetchVal);
GroupInfo[xf][GroupName] = strval(fetchVal);
mysql_fetch_field("Enabled", fetchVal);
GroupInfo[xf][Enabled] = strval(fetchVal);
mysql_fetch_field("MOTD", fetchVal);
GroupInfo[xf][MOTD] = strval(fetchVal);
}
}
mysql_free_result(); //Free the result
return 1;
}