What is better to use with MySQL?
#1

I'm debating myself on a couple things, one of which is the method to 'fetch' data from a MySQL database. So which way it best?

1. Fetching each field one by one using

pawn Код:
native mysql_fetch_field
2. Or Using SSCANF and doing something like this?

pawn Код:
mysql_fetch_row(Query, "|");
sscanf(Query, "e<p<|>ds[23]s[30]ddfffdddddddddddd>", PlayerStatistics[playerid]);
Reply
#2

i like the sscanf way
Reply
#3

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
i like the sscanf way
I like that way as well, especially since its a lot faster to script in.
Reply
#4

sscanf is way more efficient. Fetch_field will always return a string afaik so it's more code if you need integers or floats. I always use sscanf unless i need to acquire full sentences like player's title or greeting message - it's hard to predict what characters they will use so i cant sscanf that. Also the sscanf method i just cleaner.
Reply
#5

Quote:
Originally Posted by mick88
Посмотреть сообщение
sscanf is way more efficient. Fetch_field will always return a string afaik so it's more code if you need integers or floats. I always use sscanf unless i need to acquire full sentences like player's title or greeting message - it's hard to predict what characters they will use so i cant sscanf that. Also the sscanf method i just cleaner.
Okay, so SSCANF is probably the way to go. Thank you, Mick.
Reply
#6

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Okay, so SSCANF is probably the way to go. Thank you, Mick.
Do a tick test
Reply
#7

I think I've told you the anwser on msn already, like a hundred times
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)