SA-MP Forums Archive
Writing and Displaying Strings From a DB - 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: Writing and Displaying Strings From a DB (/showthread.php?tid=426628)



Writing and Displaying Strings From a DB - Skyrise - 29.03.2013

I am having issues with writing a string to the DB. It also will not display (possibly even load) correctly.

When I write an integer, it works and displays correctly.












Re: Writing and Displaying Strings From a DB - Vince - 29.03.2013

That's because cache_get_field requires a max_len, which it cannot properly calculate if the variable is in an enum.


Re: Writing and Displaying Strings From a DB - Skyrise - 29.03.2013

How would I fix this?


Re: Writing and Displaying Strings From a DB - Skyrise - 05.04.2013

Bump. Dump. Trump.


Re: Writing and Displaying Strings From a DB - ReneG - 05.04.2013

Add a maximum length.... Look at these cache functions (if you're using R8)
pawn Код:
// Cache functions.
native cache_get_data(&num_rows, &num_fields, connectionHandle = 1);
native cache_get_field(field_index, destination[], connectionHandle = 1, max_len=sizeof(destination));
native cache_get_row(row, idx, destination[], connectionHandle = 1, max_len=sizeof(destination));
native cache_get_row_int(row, idx, connectionHandle = 1);
native Float:cache_get_row_float(row, idx, connectionHandle = 1);
native cache_get_field_content(row, const field_name[], destination[], connectionHandle = 1, max_len=sizeof(destination));
native cache_get_field_int(row, const field_name[], connectionHandle = 1);
native Float:cache_get_field_float(row, const field_name[], connectionHandle = 1);