[sscanf] pawn to php
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
Again, why are you storing multiple values in a single column? That's really not how you should be using a database. Make a new table for the object IDs and store one per row.
Sorry, my bad. I didn't understand the question.

I already have a table with all objects and x,y,z: https://imgur.com/a/jmB80p3

So, above is a pictures with all the objects and x,y,z. When a new player register, he got some random objectID from this table, and all the id that player get, i'm saving in a different table.

And i'm using something like that to save the id in database.

Код:
public saveQuest(playerid) {

  generateIdRandomFromDb(playerid);

new string[256];
string[0] = (EOS);


for(new x; x < 50; x++) {
          format(string, sizeof string, "%s %d", questInfo[playerid][databaseID_object][x]);
}

mysql_format(db, string, sizeof string, "UPDATE `special_table` SET `objectID` = '%e' WHERE `playerID` = %d LIMIT 1;", string, pID[playerid]);
mysql_tquery(db, string);

}
This is the most easier way to do for myself and for the system. Better ways aren't (I think).
And simply, when a player connect, i've loaded his id of an object from database:
Код:
// public LoadQuest (playerid) {
     mysql_format(db, Gstring, "SELECt blablabla.... WHERE id .. bla blabla
    mysql_tquery(db, Gstrin, bla bla bla..
}


//another public

public finishLoad(playerid) {
if(!cache_num_rows()) return 1;

new show_s[300], var_storage[50];
cache_get_field_content(0, "ObjectID", show_s);
sscanf(show_s, "a<i>[50]", var_storage);

for(new x; x < 50; x++) {
        questInfo[playerid][databaseID_object][x] = var_storage[x];

}

}
So every think work perfectly, but i don't know how to store in php the objectID in a array like $var_storage[x]
to make a loop and create red marker on the San Andreas map.
Reply


Messages In This Thread
[sscanf] pawn to php - by None1337 - 23.08.2018, 13:47
Re: [sscanf] pawn to php - by coool - 23.08.2018, 16:47
Re: [sscanf] pawn to php - by OneDay - 23.08.2018, 17:36
Re: [sscanf] pawn to php - by None1337 - 24.08.2018, 11:06
Re: [sscanf] pawn to php - by None1337 - 24.08.2018, 22:44
Re: [sscanf] pawn to php - by None1337 - 24.08.2018, 23:42
Re: [sscanf] pawn to php - by CodeStyle175 - 25.08.2018, 09:02
Re: [sscanf] pawn to php - by bgedition - 25.08.2018, 10:05
Re: [sscanf] pawn to php - by None1337 - 26.08.2018, 12:37

Forum Jump:


Users browsing this thread: 1 Guest(s)