Hey all,
I'm stuck with the following:
The mysql_real_esca pe_string(conn, to, from, strlen(from)) function does not return the escaped string. So how can I go about writing a wrapper for it so that it RETURNS the 'to' string which in turn helps me fill out a query in the following manner using sprintf:
You see the problem I'm running into is that the same "wrapper" function is going to be called more than once in a single sprintf statement. That is causing the return value to get overwritten after every call to "wrapper", leading to all values in the table being one and the same (as the return value of the last wrapper function call).
Can anybody help? :((
I'm sure this is a common problem and there must be a better and more established way of doing it. Just point me in the right direction.
Thanks in advance,
Sid :O)
I'm stuck with the following:
The mysql_real_esca pe_string(conn, to, from, strlen(from)) function does not return the escaped string. So how can I go about writing a wrapper for it so that it RETURNS the 'to' string which in turn helps me fill out a query in the following manner using sprintf:
Code:
unescaped_query = "INSERT into MYTABLE values ('%s', '%s')";
sprintf(escaped_query, unescaped_query, wrapper(<string argument no.1 that needs to be escaped>, wrapper(<string argument no.2 that needs to be escaped>);
/* Execute escaped_query */
You see the problem I'm running into is that the same "wrapper" function is going to be called more than once in a single sprintf statement. That is causing the return value to get overwritten after every call to "wrapper", leading to all values in the table being one and the same (as the return value of the last wrapper function call).
Can anybody help? :((
I'm sure this is a common problem and there must be a better and more established way of doing it. Just point me in the right direction.
Thanks in advance,
Sid :O)
Comment