08.07.2010, 10:09
How Should I get the MySQL Query's result with G-Stylezz's SQL plugin?
format(query, sizeof(query), "SELECT ....
mysql_query(query); // Because its the query string
print(query); // to print what ever is in the query string
new string1[256]; new result1; format(string1,sizeof(string1),"SELECT `cash` FROM `users` WHERE `username` = '%s' AND `password` = '%s'",playername2, passnow); result1 = mysql_query(string1); new stores; stores = mysql_store_result(result1); new cash; new Field[64]; ammount = mysql_fetch_row_format(Field, "|", stores); cash = mysql_free_result(); format(string, sizeof(string), "Cash Loaded, you have $ %s", cash); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); GivePlayerMoney(playerid,cash);
new
Escape[2][50],
Field[9],
mycash;
mysql_real_escape_strig(playername2, Escape[0]);
mysql_real_escape_strig(passnow, Escape[1]);
format(string1,sizeof(string1),"SELECT * FROM `users` WHERE `username` = '%s' AND `password` = '%s'",Escape[0], Escape[1]);
mysql_query(string1);
mysql_store_result();
if(mysql_retrieve_row()) {
mysql_get_field("cash", Field);
mycash = strval(Field);
}
mysql_free_result();
format(string, sizeof(string), "Cash Loaded, you have $ %s", mycash );
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GivePlayerMoney(playerid,mycash );
format(query, sizeof(query), "SELECT ...
mysql_query(query);
mysql_store_result();