Exist a tutorial of mysql cache result on the forum? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Exist a tutorial of mysql cache result on the forum? (
/showthread.php?tid=657298)
Exist a tutorial of mysql cache result on the forum? -
R3SpaWn0 - 04.08.2018
Hi, i want to learn how to make a simple query, cache the result and then delete it :S
i m searching on gglee, i dont find nothing, here i dont see nothing, it's impossible..
i want to make a query to sqlid to return me the name of player and i dont know, i'm trying to copy other codes but its not same mysql functions and i get errors warnings... i want to learn and i dont know where, but i won' t give up !!!!
Re: Exist a tutorial of mysql cache result on the forum? -
Sabur - 04.08.2018
pawn Код:
GetPlant_Owner(sqlid)
{
new query, id;
mysql_format(handle, query, sizeof(query), "SELECT `Character` FROM `characters` WHERE `ID` = '%d'", ReturnName(sqlid));
new Cache:result = mysql_query(handle, query);
if(cache_num_rows())
{
cache_get_value_int(id, "id", id);
}
cache_delete(result);
return id;
}
I don't know how to explain but take the code above as an example.
Re: Exist a tutorial of mysql cache result on the forum? -
R3SpaWn0 - 04.08.2018
Quote:
Originally Posted by Sabur
pawn Код:
GetPlant_Owner(sqlid) { new query, id;
mysql_format(handle, query, sizeof(query), "SELECT `Character` FROM `characters` WHERE `ID` = '%d'", ReturnName(sqlid)); new Cache:result = mysql_query(handle, query);
if(cache_num_rows()) { cache_get_value_int(id, "id", id); } cache_delete(result);
return id; }
I don't know how to explain but take the code above as an example.
|
It throws me errors becouse i use blue G r39 or r41 so its not mysql_format, this is an example:
PHP код:
new
query[512],
buffer[129];
WP_Hash(buffer, sizeof(buffer), password);
format(query, sizeof(query), "INSERT INTO `accounts` (`Username`, `Password`, `RegisterDate`, `LoginDate`) VALUES('%s', '%s', '%s', '%s')", username, buffer, ReturnDate(), ReturnDate());
mysql_tquery(g_iHandle, query);
can you write in this? :S