PDA

View Full Version : Column mysql


qmnty
21/03/2015, 12:33 AM
Where is better way to do this?

Column like this?

Code 1:

mysql_get_field("vModel", szFile);
sscanf(szFile, "p<|>ddd", vehicleInfo[extraid][0][vModel], vehicleInfo[extraid][1][vModel], vehicleInfo[extraid][2][vModel]);

Or

this?

Code 2:

mysql_get_field("vModel1", szFile);
vehicleInfo[extraid][0][vModel] = strval(szFile);

mysql_get_field("vModel2", szFile);
vehicleInfo[extraid][1][vModel] = strval(szFile);

mysql_get_field("vModel3", szFile);
vehicleInfo[extraid][2][vModel] = strval(szFile);


but is that make load the data in code 2 is much longer than code 1?

Thanks...

mirou123
21/03/2015, 09:54 AM
The first one is better IMHO for the simple reasons that it's shorter and you won't need to create a shitload of columns in your DB

Vince
21/03/2015, 10:07 AM
Neither. You update your plugin and use cache_get_row_int.

mirou123
21/03/2015, 10:14 AM
Neither. You update your plugin and use cache_get_row_int.
Actually if he updates his plugin it would be better to do something like the first code, using cahce_ger_row. and then using sscanf for the reasons I mentioned in my first post.