24.03.2013, 16:51
Quote:
Hey,
Which Command can I use for Get float in R7? Code:
stock Float:mysql_GetFloat(Table[], Field[], Where[], Is[]) { new Query[128], Float:sqlfloat; mysql_real_escape_string(Table, Table); mysql_real_escape_string(Field, Field); mysql_real_escape_string(Where, Where); mysql_real_escape_string(Is, Is); format(Query, sizeof(Query), "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is); mysql_function_query(MYSQLConnection,Query,true,"QueryFinished",""); mysql_store_result(); mysql_fetch_float(sqlfloat); mysql_free_result(); return sqlfloat; } Any ideas |
Code:
/** * Copyright © 2013 - Dan * All rights reserved. */ // Gets an int from the MySQL result using a field name. stock mysql_fetch_field_row_int(fieldname[], connectionHandle) { new ret[64]; mysql_fetch_field_row(ret, fieldname, connectionHandle); return strval(ret); } // Gets a float from the MySQL result using a field name. forward Float:mysql_fetch_field_row_float(fieldname[], connectionHandle); stock Float:mysql_fetch_field_row_float(fieldname[], connectionHandle) { new ret[64]; mysql_fetch_field_row(ret, fieldname, connectionHandle); return floatstr(ret); } // Gets an int from the cache using a field ID. stock cache_get_row_int(row, idx, connectionHandle) { new ret[64]; cache_get_row(row, idx, ret, connectionHandle, sizeof(ret)); return strval(ret); } // Gets a float from the cache using a field ID. forward Float:cache_get_row_float(row, idx, connectionHandle); stock Float:cache_get_row_float(row, idx, connectionHandle) { new ret[64]; cache_get_row(row, idx, ret, connectionHandle, sizeof(ret)); return floatstr(ret); } // Gets an int from the cache using a field name. stock cache_get_field_content_int(row, const fieldname[], connectionHandle) { new ret[64]; cache_get_field_content(row, fieldname, ret, connectionHandle, sizeof(ret)); return strval(ret); } // Gets a float from the cache using a field name. forward Float:cache_get_field_content_float(row, const fieldname[], connectionHandle); stock Float:cache_get_field_content_float(row, const fieldname[], connectionHandle) { new ret[64]; cache_get_field_content(row, fieldname, ret, connectionHandle, sizeof(ret)); return floatstr(ret); }