07.01.2014, 19:19
I assume you're using mysql_ping() to retrieve the server connection, that being true/false.
I also assume you're using R7 and above, therefore I have made a piece of code:
Queries are threaded, meaning you'd do them like this(R7 -> R30 something)
mysql_function_query(connectionHandle, query[], bool:cache, callback[], format[], {Float,_}:..);
As of R33 or something they're like this:
mysql_tquery(...);
Or use the new ORM(object Relational Mapping) system, but there are tutorials for that.
EDIT #1:
Stay with R7! It's not too different and the speed difference is quite amazing. It's a ton better dude and easier to understand. But if you'd like to stay with R6-2 then feel free
I also assume you're using R7 and above, therefore I have made a piece of code:
pawn Код:
new handle = -1; // at top of script somewhere, before OnGameModeInit
OnGameModeInit(playerid)
{
handle = mysql_connect("hn", "un", "db", "pw");
if(handle)
{
print("[MYSQL] Connection Successful.");
}
else
{
print("[MYSQL] Connection Unsuccessful.");
}
//rest of OnGameModeInit code here
}
mysql_function_query(connectionHandle, query[], bool:cache, callback[], format[], {Float,_}:..);
As of R33 or something they're like this:
mysql_tquery(...);
Or use the new ORM(object Relational Mapping) system, but there are tutorials for that.
EDIT #1:
Stay with R7! It's not too different and the speed difference is quite amazing. It's a ton better dude and easier to understand. But if you'd like to stay with R6-2 then feel free
