05.08.2016, 06:29
1) Use the %e specifier instead of the %s specifier to escape database inputs. Not using it will leave it vulnerable to SQL attacks. Note: works only with mysql_format.
2) To add to Stinged's reply, you have to specify your database's connection ID before specifying the size when the destination variable is an enum-array:
3) You're getting the "invalid row index" error because rows start counting at 0 instead of 1 as you thought.
@Shinja, cache_insert_id() retrieves the generated ID from the sent query. You don't generate an A_I ID from a SELECT query. You have to retrieve it like you would retrieve any other integer value:
I haven't tried using cache_insert_id() after a SELECT query, but it sounds logical.
2) To add to Stinged's reply, you have to specify your database's connection ID before specifying the size when the destination variable is an enum-array:
PHP код:
cache_get_field_content(row, const field_name[], destination[], connectionHandle, max_len);
@Shinja, cache_insert_id() retrieves the generated ID from the sent query. You don't generate an A_I ID from a SELECT query. You have to retrieve it like you would retrieve any other integer value:
PHP код:
variable = cache_get_field_content_int(row, const field_name[]);